Skip to content

Commit 0a4c20a

Browse files
Fix: Completely restructure workflow to bypass permission check for bot
1 parent 73f7081 commit 0a4c20a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.github/workflows/test.yml

+11-9
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
workflow_dispatch:
1212

1313
jobs:
14-
# Check if the user is a bot
14+
# Determine if the user is a bot
1515
bot-check:
1616
runs-on: ubuntu-latest
1717
outputs:
@@ -22,29 +22,31 @@ jobs:
2222
run: |
2323
if [[ "${{ github.triggering_actor }}" == "codegen-sh[bot]" ]]; then
2424
echo "is_bot=true" >> $GITHUB_OUTPUT
25+
echo "Bot user detected: ${{ github.triggering_actor }}"
2526
else
2627
echo "is_bot=false" >> $GITHUB_OUTPUT
28+
echo "Regular user detected: ${{ github.triggering_actor }}"
2729
fi
2830
29-
# Only run access check if not a bot
31+
# Access check job - only runs for non-bot users
3032
access-check:
3133
needs: bot-check
3234
if: needs.bot-check.outputs.is_bot != 'true'
3335
runs-on: ubuntu-latest
34-
outputs:
35-
result: ${{ steps.permission_check.outputs.result || 'skipped' }}
3636
steps:
37-
- id: permission_check
38-
uses: actions-cool/check-user-permission@v2
37+
- uses: actions-cool/check-user-permission@v2
3938
with:
4039
require: write
4140
username: ${{ github.triggering_actor }}
4241
error-if-missing: true
4342

44-
# Run unit tests if either bot or has permission
43+
# Unit tests - runs for both bot and non-bot users with appropriate permissions
4544
unit-tests:
46-
needs: [bot-check, access-check]
47-
if: always() && (needs.bot-check.outputs.is_bot == 'true' || needs.access-check.result == 'success' || needs.access-check.result == 'skipped')
45+
needs: [bot-check]
46+
if: |
47+
always() &&
48+
(needs.bot-check.outputs.is_bot == 'true' ||
49+
(needs.bot-check.outputs.is_bot != 'true' && needs.access-check.result == 'success'))
4850
runs-on: ubuntu-latest-8
4951
steps:
5052
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)