Skip to content

Commit 0eb359d

Browse files
authored
ci: auto-run E2E tests for authorized team members (#495)
1 parent b10b2c7 commit 0eb359d

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

.github/workflows/e2e-tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,33 @@ permissions:
1717
contents: read
1818

1919
jobs:
20+
authorize:
21+
runs-on: ubuntu-latest
22+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request_target'
23+
outputs:
24+
is_authorized: ${{ steps.check.outputs.is_authorized }}
25+
steps:
26+
- name: Check authorization
27+
id: check
28+
run: |
29+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
30+
echo "✅ Manual workflow dispatch — authorized"
31+
echo "is_authorized=true" >> "$GITHUB_OUTPUT"
32+
exit 0
33+
fi
34+
AUTHORIZED_USERS="${{ secrets.AUTHORIZED_USERS }}"
35+
if [[ ",$AUTHORIZED_USERS," == *",${{ github.actor }},"* ]]; then
36+
echo "✅ User ${{ github.actor }} is authorized"
37+
echo "is_authorized=true" >> "$GITHUB_OUTPUT"
38+
else
39+
echo "⏭️ User ${{ github.actor }} is not in AUTHORIZED_USERS — skipping E2E tests."
40+
echo "ℹ️ External contributors: ask a maintainer to run the E2E tests manually via workflow_dispatch."
41+
echo "is_authorized=false" >> "$GITHUB_OUTPUT"
42+
fi
43+
2044
e2e:
45+
needs: authorize
46+
if: needs.authorize.outputs.is_authorized == 'true'
2147
runs-on: ubuntu-latest
2248
environment: e2e-testing
2349
timeout-minutes: 30

0 commit comments

Comments
 (0)