1818 pull-requests : write
1919 outputs :
2020 comment_id : ${{ steps.comment.outputs.comment_id }}
21+ authorized : ${{ steps.auth.outputs.authorized }}
2122 steps :
23+ - name : Authorize commenter
24+ id : auth
25+ env :
26+ AUTHOR_ASSOCIATION : ${{ github.event.comment.author_association }}
27+ ACTOR : ${{ github.actor }}
28+ run : |
29+ case "$AUTHOR_ASSOCIATION" in
30+ OWNER|MEMBER|COLLABORATOR)
31+ echo "authorized=true" >> "$GITHUB_OUTPUT"
32+ ;;
33+ *)
34+ echo "::error::User '${ACTOR}' (association: ${AUTHOR_ASSOCIATION}) is not authorized to trigger this workflow."
35+ echo "authorized=false" >> "$GITHUB_OUTPUT"
36+ exit 1
37+ ;;
38+ esac
39+
2240 - name : Acknowledge with 👀
2341 env :
2442 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4664 gpu :
4765 name : Run pytest on GPU
4866 needs : gate
67+ if : ${{ needs.gate.outputs.authorized == 'true' }}
4968 # A newer command on the same PR supersedes an in-flight one. Scoped to this job
5069 # only so the superseded run's `report` still updates its comment.
5170 concurrency :
7594 shell : bash
7695 steps :
7796 - name : Checkout PR head
78- uses : actions/checkout@v7
97+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
7998 with :
8099 # Works for forks too — no fork credentials needed.
81100 ref : refs/pull/${{ github.event.issue.number }}/head
@@ -116,7 +135,7 @@ jobs:
116135
117136 - name : Test suite reports artifacts
118137 if : ${{ always() }}
119- uses : actions/upload-artifact@v7.0.1
138+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
120139 with :
121140 name : bot_gpu_test_reports
122141 path : reports
@@ -126,7 +145,7 @@ jobs:
126145 needs : [gate, gpu]
127146 # Always run so the comment is updated on success, failure, or cancellation —
128147 # but only if `gate` actually posted a comment to update.
129- if : ${{ always() && needs.gate.outputs.comment_id != '' }}
148+ if : ${{ always() && needs.gate.outputs.authorized == 'true' && needs.gate.outputs. comment_id != '' }}
130149 runs-on : ubuntu-22.04
131150 permissions :
132151 pull-requests : write
0 commit comments