Skip to content

Commit 9ad7b5d

Browse files
committed
Check permission to run benchmarks
1 parent 1445e55 commit 9ad7b5d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/benchmarks.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ jobs:
3030
- name: Enable CPU boost
3131
run: echo "1" | sudo tee /sys/devices/system/cpu/cpufreq/boost
3232

33+
- name: Check membership
34+
if: ${{ env.PR_NUMBER }}
35+
run: |
36+
if [[ $(gh api /orgs/{owner}/members --jq 'any(.login == env.GITHUB_ACTOR)') != true ]]; then
37+
gh pr comment $PR_NUMBER -b "Sorry, you don't have permission to run benchmarks."
38+
exit 1
39+
fi
40+
3341
- name: Post initial comment
3442
run: |
3543
if [[ $PR_NUMBER ]]; then
@@ -149,7 +157,7 @@ jobs:
149157
gh api "$COMMENT_UPDATE_URL" -X PATCH -f body="$BODY"
150158
151159
- name: Post failure comment
152-
if: ${{ failure() }}
160+
if: ${{ failure() && env.COMMENT_UPDATE_URL }}
153161
run: |
154162
BODY="Benchmarking failed. Please check [the workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details."
155163
gh api "$COMMENT_UPDATE_URL" -X PATCH -f body="$BODY"

0 commit comments

Comments
 (0)