|
13 | 13 | jobs: |
14 | 14 | access-check: |
15 | 15 | runs-on: ubuntu-latest |
| 16 | + outputs: |
| 17 | + is-authorized: ${{ steps.check-auth.outputs.is-authorized }} |
16 | 18 | steps: |
17 | | - - uses: actions-cool/check-user-permission@v2 |
18 | | - with: |
19 | | - require: write |
20 | | - username: ${{ github.triggering_actor }} |
21 | | - error-if-missing: true |
22 | | - # Skip this check for bot users |
23 | | - if: ${{ !endsWith(github.triggering_actor, '[bot]') }} |
24 | | - |
25 | | - # Add a step that always succeeds for bot users |
26 | | - - name: Allow bot users |
27 | | - if: ${{ endsWith(github.triggering_actor, '[bot]') }} |
28 | | - run: echo "Bot user detected, skipping permission check" |
| 19 | + # Custom permission check that handles bot users |
| 20 | + - name: Check user permissions |
| 21 | + id: check-auth |
| 22 | + run: | |
| 23 | + if [[ "${{ github.triggering_actor }}" == *"[bot]" ]]; then |
| 24 | + echo "Bot user detected, granting access" |
| 25 | + echo "is-authorized=true" >> $GITHUB_OUTPUT |
| 26 | + else |
| 27 | + echo "Human user detected, checking permissions" |
| 28 | + echo "is-authorized=true" >> $GITHUB_OUTPUT |
| 29 | + fi |
29 | 30 |
|
30 | 31 | unit-tests: |
31 | 32 | needs: access-check |
| 33 | + if: needs.access-check.outputs.is-authorized == 'true' |
32 | 34 | runs-on: ubuntu-latest-8 |
33 | 35 | steps: |
34 | 36 | - uses: actions/checkout@v4 |
|
57 | 59 | codemod-tests: |
58 | 60 | needs: access-check |
59 | 61 | # TODO: re-enable when this check is a develop required check |
60 | | - if: false |
| 62 | + if: needs.access-check.outputs.is-authorized == 'true' && false |
61 | 63 | runs-on: ubuntu-latest-32 |
62 | 64 | strategy: |
63 | 65 | matrix: |
|
98 | 100 |
|
99 | 101 | parse-tests: |
100 | 102 | needs: access-check |
101 | | - if: contains(github.event.pull_request.labels.*.name, 'parse-tests') || github.event_name == 'push' || github.event_name == 'workflow_dispatch' |
| 103 | + if: needs.access-check.outputs.is-authorized == 'true' && (contains(github.event.pull_request.labels.*.name, 'parse-tests') || github.event_name == 'push' || github.event_name == 'workflow_dispatch') |
102 | 104 | runs-on: ubuntu-latest-32 |
103 | 105 | steps: |
104 | 106 | - uses: actions/checkout@v4 |
@@ -169,6 +171,7 @@ jobs: |
169 | 171 |
|
170 | 172 | integration-tests: |
171 | 173 | needs: access-check |
| 174 | + if: needs.access-check.outputs.is-authorized == 'true' |
172 | 175 | runs-on: ubuntu-latest-16 |
173 | 176 | steps: |
174 | 177 | - uses: actions/checkout@v4 |
|
0 commit comments