Skip to content

Commit 5ee7b34

Browse files
committed
fix: use org-scoped app token for membership check
1 parent 5318a7a commit 5ee7b34

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/cla.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ jobs:
2222
app-id: ${{ secrets.APP_ID }}
2323
private-key: ${{ secrets.APP_PRIVATE_KEY }}
2424
owner: blacklanternsecurity
25-
repositories: CLA
2625

2726
- name: Check org membership
2827
id: membership
28+
env:
29+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
2930
run: |
3031
if [ "${{ github.event_name }}" = "pull_request_target" ]; then
31-
ASSOC="${{ github.event.pull_request.author_association }}"
32+
AUTHOR="${{ github.event.pull_request.user.login }}"
3233
else
33-
ASSOC="${{ github.event.issue.author_association }}"
34+
PR_NUM="${{ github.event.issue.number }}"
35+
AUTHOR=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUM" --jq '.user.login' 2>/dev/null)
3436
fi
35-
if [ "$ASSOC" = "MEMBER" ] || [ "$ASSOC" = "OWNER" ] || [ "$ASSOC" = "COLLABORATOR" ]; then
37+
if [ -n "$AUTHOR" ] && gh api "orgs/blacklanternsecurity/members/$AUTHOR" > /dev/null 2>&1; then
3638
echo "is_member=true" >> "$GITHUB_OUTPUT"
3739
else
3840
echo "is_member=false" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)