Skip to content

Commit

Permalink
chore(ci): push generated code before cts (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp authored Apr 15, 2022
1 parent 8737e8d commit 47d6b2d
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,24 @@ jobs:
!contains(needs.*.result, 'failure')
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.TOKEN_RELEASE_BOT }}

- name: Restore cache
uses: ./.github/actions/cache
with:
job: cts

- name: Push generated code to generated branch
id: pushGeneratedCode
if: github.event_name == 'pull_request'
run: yarn workspace scripts pushGeneratedCode
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GENERATE_BOT }}
PR_NUMBER: ${{ github.event.number }}

- name: Check JavaScript client size
run: exit $(yarn workspace algoliasearch-client-javascript test:size | echo $?)

Expand All @@ -385,7 +397,7 @@ jobs:
- name: Run
run: yarn cli cts run

codegen:
codegen_on_main:
runs-on: ubuntu-20.04
timeout-minutes: 10
needs:
Expand All @@ -394,6 +406,7 @@ jobs:
- client_javascript_algoliasearch
if: |
always() &&
github.event_name == 'refs/heads/main' &&
needs.setup.outputs.RUN_CODEGEN == 'true' &&
needs.cts.result == 'success'
steps:
Expand All @@ -408,17 +421,14 @@ jobs:
with:
job: codegen

- name: Push generated code
- name: Push generated code to main
id: pushGeneratedCode
run: yarn workspace scripts pushGeneratedCode
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GENERATE_BOT }}
PR_NUMBER: ${{ github.event.number }}

- name: Spread generation to each repository
if: |
steps.pushGeneratedCode.exitcode == 0 &&
github.ref == 'refs/heads/main'
if: steps.pushGeneratedCode.exitcode == 0
run: yarn workspace scripts spreadGeneration
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_RELEASE_BOT }}

0 comments on commit 47d6b2d

Please sign in to comment.