Skip to content

Commit 9c6d7e2

Browse files
committed
Revert "chore(ci): allow fork to access secrets (#3873)"
This reverts commit 0cdb866.
1 parent d3d50b1 commit 9c6d7e2

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

.github/workflows/check.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ jobs:
2121
notification:
2222
runs-on: ubuntu-22.04
2323
timeout-minutes: 1
24-
if: ${{ github.event.number }}
24+
if: ${{ !github.event.pull_request.head.repo.fork && 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 != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
32+
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN }}
3333
message: |
3434
### 🪓 The generated code will be pushed at the end of the CI.
3535
@@ -265,11 +265,11 @@ jobs:
265265
- name: Run e2e CTS
266266
id: cts-e2e
267267
continue-on-error: true
268-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
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]') }}
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: ${{ steps.cts-e2e.outcome == 'failure' }}
272+
if: ${{ !github.event.pull_request.head.repo.fork && 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
@@ -379,11 +379,11 @@ jobs:
379379
- name: Run e2e CTS
380380
id: cts-e2e
381381
continue-on-error: true
382-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' && !contains(format('{0} {1}', github.event.pull_request.title, github.event.head_commit.message), '[skip-e2e]') }}
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]') }}
383383
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
384384

385385
- name: Retry e2e CTS
386-
if: ${{ steps.cts-e2e.outcome == 'failure' }}
386+
if: ${{ !github.event.pull_request.head.repo.fork && steps.cts-e2e.outcome == 'failure' }}
387387
run: yarn cli cts run ${{ matrix.client.language }} ${{ matrix.client.toRun }} --no-client --no-requests
388388

389389
- name: Run benchmarks
@@ -479,26 +479,22 @@ jobs:
479479
name: client swift${{ needs.setup.outputs.RUN_MACOS_SWIFT_CTS == 'true' && format('@{0}', fromJSON(needs.setup.outputs.SWIFT_DATA).version) || '' }} macos
480480
steps:
481481
- uses: actions/checkout@v4
482-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
483482

484483
- name: Download artifacts
485-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
486484
uses: ./scripts/ci/actions/restore-artifacts
487485
with:
488486
type: languages
489487
languages: |
490488
swift
491489
492490
- name: Setup
493-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
494491
uses: ./.github/actions/setup
495492
with:
496493
type: minimal
497494
language: swift
498495
version: ${{ fromJSON(needs.setup.outputs.SWIFT_DATA).version }}
499496

500497
- name: Run tests on macOS
501-
if: ${{ env.ALGOLIA_APPLICATION_ID != '' }}
502498
id: run-test
503499
continue-on-error: true
504500
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' || '' }}
@@ -532,7 +528,8 @@ jobs:
532528
with:
533529
fetch-depth: 0
534530
ref: ${{ github.event.pull_request.head.ref }}
535-
token: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
531+
token: ${{ secrets.ALGOLIA_BOT_TOKEN }}
532+
repository: ${{ github.event.pull_request.head.repo.full_name }}
536533

537534
- name: Download all artifacts
538535
uses: ./scripts/ci/actions/restore-artifacts
@@ -575,14 +572,14 @@ jobs:
575572
id: pushGeneratedCode
576573
run: yarn workspace scripts pushGeneratedCode
577574
env:
578-
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
575+
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN }}
579576
PR_NUMBER: ${{ github.event.number }}
580577

581578
- name: update generation comment
582579
uses: marocchino/sticky-pull-request-comment@v2
583580
if: ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT == '' }}
584581
with:
585-
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
582+
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN }}
586583
message: |
587584
### No code generated
588585
@@ -594,7 +591,7 @@ jobs:
594591
uses: marocchino/sticky-pull-request-comment@v2
595592
if: ${{ steps.pushGeneratedCode.outputs.GENERATED_COMMIT != '' }}
596593
with:
597-
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN != '' && secrets.ALGOLIA_BOT_TOKEN || secrets.GITHUB_TOKEN }}
594+
GITHUB_TOKEN: ${{ secrets.ALGOLIA_BOT_TOKEN }}
598595
message: |
599596
### ✔️ Code generated!
600597
@@ -663,8 +660,9 @@ jobs:
663660
- uses: actions/checkout@v4
664661
with:
665662
fetch-depth: 0
666-
ref: ${{ github.event.pull_request.head.ref }}
663+
ref: ${{ needs.codegen.outputs.generatedCommit }}
667664
token: ${{ secrets.ALGOLIA_BOT_TOKEN }}
665+
repository: ${{ github.event.pull_request.head.repo.full_name }}
668666

669667
- name: Setup
670668
uses: ./.github/actions/setup

0 commit comments

Comments
 (0)