Skip to content

Commit 5af4335

Browse files
Fix: Create separate workflow paths for bot and non-bot users
1 parent 0a4c20a commit 5af4335

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

.github/workflows/test.yml

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

1313
jobs:
14-
# Determine if the user is a bot
14+
# Skip all checks for bot users
1515
bot-check:
1616
runs-on: ubuntu-latest
1717
outputs:
@@ -20,6 +20,7 @@ jobs:
2020
- name: Check if user is bot
2121
id: check_bot
2222
run: |
23+
echo "Actor: ${{ github.triggering_actor }}"
2324
if [[ "${{ github.triggering_actor }}" == "codegen-sh[bot]" ]]; then
2425
echo "is_bot=true" >> $GITHUB_OUTPUT
2526
echo "Bot user detected: ${{ github.triggering_actor }}"
@@ -28,7 +29,36 @@ jobs:
2829
echo "Regular user detected: ${{ github.triggering_actor }}"
2930
fi
3031
31-
# Access check job - only runs for non-bot users
32+
# Run unit tests directly for bot users
33+
bot-unit-tests:
34+
needs: bot-check
35+
if: needs.bot-check.outputs.is_bot == 'true'
36+
runs-on: ubuntu-latest-8
37+
steps:
38+
- uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 0
41+
ref: ${{ github.event.pull_request.head.sha }}
42+
43+
- name: Setup environment
44+
uses: ./.github/actions/setup-environment
45+
46+
- name: Test with pytest
47+
timeout-minutes: 5
48+
run: |
49+
uv run pytest \
50+
-n auto \
51+
--cov src \
52+
--timeout 15 \
53+
-o junit_suite_name="${{github.job}}" \
54+
tests/unit
55+
56+
- uses: ./.github/actions/report
57+
with:
58+
flag: unit-tests
59+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
60+
61+
# Access check for non-bot users
3262
access-check:
3363
needs: bot-check
3464
if: needs.bot-check.outputs.is_bot != 'true'
@@ -40,13 +70,10 @@ jobs:
4070
username: ${{ github.triggering_actor }}
4171
error-if-missing: true
4272

43-
# Unit tests - runs for both bot and non-bot users with appropriate permissions
73+
# Unit tests for non-bot users
4474
unit-tests:
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'))
75+
needs: [bot-check, access-check]
76+
if: needs.bot-check.outputs.is_bot != 'true'
5077
runs-on: ubuntu-latest-8
5178
steps:
5279
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)