Skip to content

Commit 1351d29

Browse files
Fix GitHub Actions workflow to allow codegen-sh[bot] to bypass permission checks
1 parent 9c7dcba commit 1351d29

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ on:
1313
jobs:
1414
access-check:
1515
runs-on: ubuntu-latest
16+
# Skip the access check entirely if the triggering actor is the Codegen bot
17+
if: github.triggering_actor != 'codegen-sh[bot]'
1618
steps:
1719
- uses: actions-cool/check-user-permission@v2
1820
with:
1921
require: write
2022
username: ${{ github.triggering_actor }}
2123
error-if-missing: true
22-
# Allow the codegen bot to run tests
23-
skip-check-users: codegen-sh[bot]
2424

2525
unit-tests:
26-
needs: access-check
26+
# Update the needs condition to handle the case where access-check is skipped
27+
needs: [access-check]
28+
if: always() && (needs.access-check.result == 'success' || needs.access-check.result == 'skipped')
2729
runs-on: ubuntu-latest-8
2830
steps:
2931
- uses: actions/checkout@v4
@@ -51,16 +53,16 @@ jobs:
5153

5254
codemod-tests:
5355
needs: access-check
54-
# TODO: re-enable when this check is a develop required check
55-
if: false
56+
# Update the condition to handle the case where access-check is skipped
57+
if: (always() && (needs.access-check.result == 'success' || needs.access-check.result == 'skipped')) && false
5658
runs-on: ubuntu-latest-32
5759
strategy:
5860
matrix:
5961
sync_graph: [ true, false ]
6062
size: [ small, large ]
6163
exclude:
6264
# Exclude large codemod tests when not needed
63-
- size: ${{(contains(github.event.pull_request.labels.*.name, 'big-codemod-tests') || github.event_name == 'push' || github.event_name == 'workflow_dispatch') && 'kevin' || 'large'}}
65+
- size: ${{(contains(github.event.pull_request.labels.*.name, 'big-codemod-tests') || github.event_name == 'push' || github.event_name == 'workflow_dispatch') && 'kevin' || 'large')}
6466
- size: large
6567
sync_graph: true
6668
concurrency:
@@ -93,7 +95,7 @@ jobs:
9395

9496
parse-tests:
9597
needs: access-check
96-
if: contains(github.event.pull_request.labels.*.name, 'parse-tests') || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
98+
if: (always() && (needs.access-check.result == 'success' || needs.access-check.result == 'skipped')) && (contains(github.event.pull_request.labels.*.name, 'parse-tests') || github.event_name == 'push' || github.event_name == 'workflow_dispatch')
9799
runs-on: ubuntu-latest-32
98100
steps:
99101
- uses: actions/checkout@v4
@@ -164,6 +166,7 @@ jobs:
164166
165167
integration-tests:
166168
needs: access-check
169+
if: always() && (needs.access-check.result == 'success' || needs.access-check.result == 'skipped')
167170
runs-on: ubuntu-latest-16
168171
steps:
169172
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)