@@ -21,15 +21,16 @@ jobs:
2121 notification :
2222 runs-on : ubuntu-22.04
2323 timeout-minutes : 1
24- if : ${{ !github.event.pull_request.head.repo.fork && github.event.number }}
24+ if : ${{ github.event.number }}
2525 permissions :
2626 pull-requests : write
27+ issues : write
2728 steps :
2829 - uses : actions/checkout@v4
2930
3031 - uses : marocchino/sticky-pull-request-comment@v2
3132 with :
32- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
33+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
3334 message : |
3435 ### 🪓 The generated code will be pushed at the end of the CI.
3536
@@ -265,11 +266,11 @@ jobs:
265266 - name : Run e2e CTS
266267 id : cts-e2e
267268 continue-on-error : true
268- if : ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
269+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
269270 run : yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests
270271
271272 - name : Retry e2e CTS
272- if : ${{ !github.event.pull_request.head.repo.fork && steps.cts-e2e.outcome == 'failure' }}
273+ if : ${{ steps.cts-e2e.outcome == 'failure' }}
273274 run : yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests
274275
275276 - name : Run benchmarks
@@ -379,11 +380,11 @@ jobs:
379380 - name : Run e2e CTS
380381 id : cts-e2e
381382 continue-on-error : true
382- if : ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
383+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
383384 run : yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
384385
385386 - name : Retry e2e CTS
386- if : ${{ !github.event.pull_request.head.repo.fork && steps.cts-e2e.outcome == 'failure' }}
387+ if : ${{ steps.cts-e2e.outcome == 'failure' }}
387388 run : yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
388389
389390 - name : Run benchmarks
@@ -479,22 +480,26 @@ jobs:
479480 name : client swift${{ needs.setup.outputs.RUN_MACOS_SWIFT_CTS == 'true' && format('@{0}', fromJSON(needs.setup.outputs.SWIFT_DATA).version) || '' }} macos
480481 steps :
481482 - uses : actions/checkout@v4
483+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
482484
483485 - name : Download artifacts
486+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
484487 uses : ./scripts/ci/actions/restore-artifacts
485488 with :
486489 type : languages
487490 languages : |
488491 swift
489492
490493 - name : Setup
494+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
491495 uses : ./.github/actions/setup
492496 with :
493497 type : minimal
494498 language : swift
495499 version : ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }}
496500
497501 - name : Run tests on macOS
502+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
498503 id : run-test
499504 continue-on-error : true
500505 run : yarn cli cts run swift ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).toRun }} -v ${{ !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') && '--no-e2e' || '' }}
@@ -528,8 +533,7 @@ jobs:
528533 with :
529534 fetch-depth : 0
530535 ref : ${{ github.event.pull_request.head.ref }}
531- token : ${{ secrets.ALGOLIA_BOT_TOKEN }}
532- repository : ${{ github.event.pull_request.head.repo.full_name }}
536+ token : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
533537
534538 - name : Download all artifacts
535539 uses : ./scripts/ci/actions/restore-artifacts
@@ -572,14 +576,14 @@ jobs:
572576 id : pushGeneratedCode
573577 run : yarn workspace scripts pushGeneratedCode
574578 env :
575- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
579+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
576580 PR_NUMBER : ${{ github.event.number }}
577581
578582 - name : update generation comment
579583 uses : marocchino/sticky-pull-request-comment@v2
580584 if : ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT == '' }}
581585 with :
582- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
586+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
583587 message : |
584588 ### No code generated
585589
@@ -591,7 +595,7 @@ jobs:
591595 uses : marocchino/sticky-pull-request-comment@v2
592596 if : ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT != '' }}
593597 with :
594- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
598+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
595599 message : |
596600 ### ✔️ Code generated!
597601
@@ -660,9 +664,8 @@ jobs:
660664 - uses : actions/checkout@v4
661665 with :
662666 fetch-depth : 0
663- ref : ${{ needs.codegen.outputs.generatedCommit }}
667+ ref : ${{ github.event.pull_request.head.ref }}
664668 token : ${{ secrets.ALGOLIA_BOT_TOKEN }}
665- repository : ${{ github.event.pull_request.head.repo.full_name }}
666669
667670 - name : Setup
668671 uses : ./.github/actions/setup
0 commit comments