Skip to content

Commit 546e23c

Browse files
committed
Fix breaking pre-review job on contributor
- contributors in this context of github original repo don't allow to assign assignee not listed in repo contributors - to do so we also need PAT token with write permissions
1 parent a2689ac commit 546e23c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

.github/workflows/pre-review.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ jobs:
6363
printf '%s\n' "$CHANGED_FILES" >> $GITHUB_ENV
6464
echo "EOF" >> $GITHUB_ENV
6565
66-
GITHUB_PERMISSION_ROLE=$(gh api "repos/$BASE_REPO/collaborators/$CONTRIBUTOR/permission" -q '.role_name' 2>/dev/null || echo 'unknown')
66+
if [[ "$GITHUB_PERMISSION_ROLE" != "unknown" ]]; then
67+
echo "Assigning contributor: $CONTRIBUTOR"
68+
gh pr edit "$PR_NUMBER" --add-assignee "$CONTRIBUTOR" -R "$BASE_REPO"
69+
else
70+
echo "Contributor $CONTRIBUTOR is not a collaborator — skipping assignment"
71+
fi
6772
setEnv "GITHUB_PERMISSION_ROLE"
6873
6974
- name: Run "preReview" script

0 commit comments

Comments
 (0)