@@ -21,15 +21,15 @@ 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
2727 steps :
2828 - uses : actions/checkout@v4
2929
3030 - uses : marocchino/sticky-pull-request-comment@v2
3131 with :
32- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
32+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
3333 message : |
3434 ### 🪓 The generated code will be pushed at the end of the CI.
3535
@@ -174,7 +174,7 @@ jobs:
174174 path : ${{ fromJSON(needs.setup.outputs.SPECS_MATRIX).bundledPath }}
175175
176176 client_gen_javascript :
177- timeout-minutes : 10
177+ timeout-minutes : 15
178178 runs-on : ubuntu-22.04
179179 needs :
180180 - setup
@@ -265,21 +265,30 @@ jobs:
265265 - name : Run e2e CTS
266266 id : cts-e2e
267267 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]') }}
268+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
269269 run : yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests
270270
271271 - name : Retry e2e CTS
272- if : ${{ !github.event.pull_request.head.repo.fork && steps.cts-e2e.outcome == 'failure' }}
272+ if : ${{ steps.cts-e2e.outcome == 'failure' }}
273273 run : yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --no-client --no-requests
274274
275275 - name : Run benchmarks
276276 run : yarn cli cts run javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }} --benchmark --no-client --no-requests --no-e2e
277277
278- - name : Generate code snippets for documentation
278+ - name : Generate code snippets
279279 run : yarn cli snippets javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
280+
281+ - name : Build the snippets to check validity
282+ run : yarn cli build snippets javascript
283+
284+ - name : Generate code guides
285+ run : yarn cli guides javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).toRun }}
286+
287+ - name : Build the guides to check validity
288+ run : yarn cli build guides javascript
280289
281290 - name : Zip artifact before storing
282- run : zip -r -y clients-javascript.zip clients/algoliasearch-client-javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).testsToStore }} ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).snippetsToStore }} -x "**/node_modules**" "**/.yarn/cache/**" "**/.yarn/install-state.gz" "**/build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/.nx/**"
291+ run : zip -r -y clients-javascript.zip clients/algoliasearch-client-javascript ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).testsToStore }} ${{ fromJSON(needs.setup.outputs.JAVASCRIPT_DATA).guidesToStore }} -x "**/node_modules**" "**/.yarn/cache/**" "**/.yarn/install-state.gz" "**/build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/.nx/**"
283292
284293 - name : Store javascript clients
285294 uses : actions/upload-artifact@v4
@@ -370,26 +379,32 @@ jobs:
370379 - name : Run e2e CTS
371380 id : cts-e2e
372381 continue-on-error : true
373- if : ${{ !github.event.pull_request.head.repo.fork && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
382+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
374383 run : yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
375384
376385 - name : Retry e2e CTS
377- if : ${{ !github.event.pull_request.head.repo.fork && steps.cts-e2e.outcome == 'failure' }}
386+ if : ${{ steps.cts-e2e.outcome == 'failure' }}
378387 run : yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
379388
380389 - name : Run benchmarks
381390 if : ${{ matrix.client.isMainVersion }}
382391 run : yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --benchmark --no-client --no-requests --no-e2e
383392
384- - name : Generate code snippets for documentation
393+ - name : Generate code snippets
385394 run : yarn cli snippets ${{ matrix.client.language }} ${{ matrix.client.toRun }}
386395
387396 - name : Build the snippets to check validity
388397 run : yarn cli build snippets ${{ matrix.client.language }}
389398
399+ - name : Generate code guides
400+ run : yarn cli guides ${{ matrix.client.language }} ${{ matrix.client.toRun }}
401+
402+ - name : Build the guides to check validity
403+ run : yarn cli build guides ${{ matrix.client.language }}
404+
390405 - name : Zip artifact before storing
391406 if : ${{ matrix.client.isMainVersion }}
392- run : zip -r -y clients-${{ matrix.client.language }}.zip ${{ matrix.client.path }} ${{ matrix.client.testsToStore }} ${{ matrix.client.snippetsToStore }} -x "**/node_modules**" "**/__pycache__/**" "**/.yarn/cache/**" "**/build/**" "**/.build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/vendor/**" "**/target/**" "**/.dart_tool/**"
407+ run : zip -r -y clients-${{ matrix.client.language }}.zip ${{ matrix.client.path }} ${{ matrix.client.testsToStore }} ${{ matrix.client.guidesToStore }} -x "**/node_modules**" "**/__pycache__/**" "**/.yarn/cache/**" "**/build/**" "**/.build/**" "**/dist/**" "**/.gradle/**" "**/bin/**" "**/vendor/**" "**/target/**" "**/.dart_tool/**"
393408
394409 - name : Store ${{ matrix.client.language }} clients
395410 if : ${{ matrix.client.isMainVersion }}
@@ -464,22 +479,26 @@ jobs:
464479 name : client swift${{ needs.setup.outputs.RUN_MACOS_SWIFT_CTS == 'true' && format('@{0}', fromJSON(needs.setup.outputs.SWIFT_DATA).version) || '' }} macos
465480 steps :
466481 - uses : actions/checkout@v4
482+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
467483
468484 - name : Download artifacts
485+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
469486 uses : ./scripts/ci/actions/restore-artifacts
470487 with :
471488 type : languages
472489 languages : |
473490 swift
474491
475492 - name : Setup
493+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
476494 uses : ./.github/actions/setup
477495 with :
478496 type : minimal
479497 language : swift
480498 version : ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }}
481499
482500 - name : Run tests on macOS
501+ if : ${{ env.ALGOLIA_APPLICATION_ID != '' }}
483502 id : run-test
484503 continue-on-error : true
485504 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' || '' }}
@@ -513,8 +532,7 @@ jobs:
513532 with :
514533 fetch-depth : 0
515534 ref : ${{ github.event.pull_request.head.ref }}
516- token : ${{ secrets.ALGOLIA_BOT_TOKEN }}
517- repository : ${{ github.event.pull_request.head.repo.full_name }}
535+ token : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
518536
519537 - name : Download all artifacts
520538 uses : ./scripts/ci/actions/restore-artifacts
@@ -557,14 +575,14 @@ jobs:
557575 id : pushGeneratedCode
558576 run : yarn workspace scripts pushGeneratedCode
559577 env :
560- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
578+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
561579 PR_NUMBER : ${{ github.event.number }}
562580
563581 - name : update generation comment
564582 uses : marocchino/sticky-pull-request-comment@v2
565583 if : ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT == '' }}
566584 with :
567- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
585+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
568586 message : |
569587 ### No code generated
570588
@@ -576,7 +594,7 @@ jobs:
576594 uses : marocchino/sticky-pull-request-comment@v2
577595 if : ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT != '' }}
578596 with :
579- GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN }}
597+ GITHUB_TOKEN : ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
580598 message : |
581599 ### ✔️ Code generated!
582600
@@ -645,9 +663,8 @@ jobs:
645663 - uses : actions/checkout@v4
646664 with :
647665 fetch-depth : 0
648- ref : ${{ needs.codegen.outputs.generatedCommit }}
666+ ref : ${{ github.event.pull_request.head.ref }}
649667 token : ${{ secrets.ALGOLIA_BOT_TOKEN }}
650- repository : ${{ github.event.pull_request.head.repo.full_name }}
651668
652669 - name : Setup
653670 uses : ./.github/actions/setup
0 commit comments