Skip to content

Commit ee514b6

Browse files
committed
fix: handle org membership check for both PR and comment events
1 parent 646b6eb commit ee514b6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

.github/workflows/cla.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,17 @@ jobs:
2626

2727
- name: Check org membership
2828
id: membership
29-
if: github.event_name == 'pull_request_target'
3029
env:
3130
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3231
run: |
33-
AUTHOR="${{ github.event.pull_request.user.login }}"
34-
if gh api "orgs/blacklanternsecurity/members/$AUTHOR" > /dev/null 2>&1; then
32+
if [ "${{ github.event_name }}" = "pull_request_target" ]; then
33+
AUTHOR="${{ github.event.pull_request.user.login }}"
34+
else
35+
# For issue_comment events, look up the PR author
36+
PR_NUM="${{ github.event.issue.number }}"
37+
AUTHOR=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUM" --jq '.user.login' 2>/dev/null)
38+
fi
39+
if [ -n "$AUTHOR" ] && gh api "orgs/blacklanternsecurity/members/$AUTHOR" > /dev/null 2>&1; then
3540
echo "is_member=true" >> "$GITHUB_OUTPUT"
3641
else
3742
echo "is_member=false" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)