@@ -15,16 +15,48 @@ permissions:
1515
1616jobs :
1717 e2e-test :
18- if : >-
19- github.event_name == 'push' ||
20- (github.event.action == 'labeled' && github.event.label.name == 'run-xks-e2e') ||
21- (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'run-xks-e2e'))
2218 runs-on : ubuntu-latest
2319 strategy :
2420 fail-fast : false
2521 matrix :
2622 cloud_provider : [azure, coreweave, aws]
2723 steps :
24+ - name : Check authorization
25+ env :
26+ EVENT_NAME : ${{ github.event_name }}
27+ AUTHOR_ASSOCIATION : ${{ github.event.pull_request.author_association }}
28+ AUTHOR_LOGIN : ${{ github.event.pull_request.user.login }}
29+ EVENT_ACTION : ${{ github.event.action }}
30+ LABEL_NAME : ${{ github.event.label.name }}
31+ HAS_LABEL : ${{ contains(github.event.pull_request.labels.*.name, 'run-xks-e2e') }}
32+ run : |
33+ TRUSTED_BOTS=("github-actions[bot]" "red-hat-konflux[bot]" "jira-autofix[bot]")
34+
35+ if [[ "$EVENT_NAME" == "push" ]]; then
36+ echo "Push to main — running automatically"
37+ exit 0
38+ fi
39+ if [[ "$AUTHOR_ASSOCIATION" =~ ^(OWNER|MEMBER|COLLABORATOR)$ ]]; then
40+ echo "Trusted contributor — running automatically"
41+ exit 0
42+ fi
43+ for bot in "${TRUSTED_BOTS[@]}"; do
44+ if [[ "$AUTHOR_LOGIN" == "$bot" ]]; then
45+ echo "Trusted bot — running automatically"
46+ exit 0
47+ fi
48+ done
49+ if [[ "$EVENT_ACTION" == "labeled" && ( "$LABEL_NAME" == "lgtm" || "$LABEL_NAME" == "approved" ) ]]; then
50+ echo "Reviewer approval ($LABEL_NAME) — running automatically"
51+ exit 0
52+ fi
53+ if [[ "$HAS_LABEL" == "true" ]]; then
54+ echo "External contributor — approved via 'run-xks-e2e' label"
55+ exit 0
56+ fi
57+ echo "::error::xKS e2e tests required. A maintainer must add the 'run-xks-e2e' label after reviewing the code."
58+ exit 1
59+
2860 - name : Checkout
2961 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3062 with :
0 commit comments