Skip to content

Commit bcb3563

Browse files
authored
devops: gate PR CI triage on write access (#42215)
1 parent e51e5b5 commit bcb3563

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/create_test_report.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,18 @@ jobs:
7474
echo "number=$NUMBER" >> "$GITHUB_OUTPUT"
7575
7676
AUTHOR=$(gh pr view --repo "${{ github.repository }}" "$HEAD_REF" --json author --jq '.author.login' 2>/dev/null || true)
77-
ALLOWED="github-actions[bot] pavelfeldman yury-s dgozman Skn0tt dcrousso"
7877
TRIAGE_ALLOWED=false
79-
for a in $ALLOWED; do
80-
if [ "$a" = "$AUTHOR" ]; then TRIAGE_ALLOWED=true; break; fi
81-
done
78+
case "$AUTHOR" in
79+
app/github-actions|app/microsoft-playwright-automation)
80+
TRIAGE_ALLOWED=true
81+
;;
82+
*)
83+
if [ -n "$AUTHOR" ]; then
84+
PERM=$(gh api "repos/${{ github.repository }}/collaborators/$AUTHOR/permission" --jq .permission 2>/dev/null || echo none)
85+
case "$PERM" in write|admin) TRIAGE_ALLOWED=true ;; esac
86+
fi
87+
;;
88+
esac
8289
echo "triage_allowed=$TRIAGE_ALLOWED" >> "$GITHUB_OUTPUT"
8390
8491
- name: Post report comment to PR

0 commit comments

Comments
 (0)