Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Commit decced3

Browse files
committed
Fix organization membership check to use PERSONAL_ACCESS_TOKEN
1 parent 7de3ac5 commit decced3

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

.github/workflows/claude-full.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
debug-mode: ${{ inputs.debug-mode || 'false' }}
6868
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
6969
github-token: ${{ github.token }}
70+
personal-access-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
7071

7172
- name: Upload claude output artifacts
7273
if: always()

scripts/issue-analyze-mode.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ DEBUG_MODE=${6:-"false"}
1212
FEEDBACK=$7
1313
REQUIRE_ORG_MEMBERSHIP=${8:-"true"}
1414
ORGANIZATION=${9:-$REPO_OWNER}
15+
PERSONAL_ACCESS_TOKEN=${10:-$GITHUB_TOKEN}
1516

1617
# Enable debug mode if requested
1718
if [[ "$DEBUG_MODE" == "true" ]]; then
@@ -108,7 +109,20 @@ ISSUE_AUTHOR=$(echo "$ISSUE_DETAILS" | jq -r '.author.login')
108109
# Check if user is a member of the organization if required
109110
if [[ "$REQUIRE_ORG_MEMBERSHIP" == "true" ]]; then
110111
echo "Checking if $ISSUE_AUTHOR is a member of organization $ORGANIZATION"
111-
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$ISSUE_AUTHOR --silent -i || true)
112+
113+
# Temporarily use the personal access token for org membership check if provided
114+
if [[ "$PERSONAL_ACCESS_TOKEN" != "$GITHUB_TOKEN" ]]; then
115+
# Save current token auth
116+
TEMP_AUTH=$(gh auth status 2>&1 | grep "Logged in")
117+
# Switch to personal token for org check
118+
echo "$PERSONAL_ACCESS_TOKEN" | gh auth login --with-token
119+
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$ISSUE_AUTHOR --silent -i || true)
120+
# Switch back to github token
121+
echo "$GITHUB_TOKEN" | gh auth login --with-token
122+
else
123+
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$ISSUE_AUTHOR --silent -i || true)
124+
fi
125+
112126
STATUS_CODE=$(echo "$ORG_CHECK" | head -n 1 | cut -d' ' -f2)
113127

114128
if [[ "$STATUS_CODE" != "204" ]]; then

scripts/issue-fix-mode.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,20 @@ ISSUE_AUTHOR=$(echo "$ISSUE_DETAILS" | jq -r '.author.login')
140140
# Check if user is a member of the organization if required
141141
if [[ "$REQUIRE_ORG_MEMBERSHIP" == "true" ]]; then
142142
echo "Checking if $ISSUE_AUTHOR is a member of organization $ORGANIZATION"
143-
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$ISSUE_AUTHOR --silent -i || true)
143+
144+
# Temporarily use the personal access token for org membership check if provided
145+
if [[ "$PERSONAL_ACCESS_TOKEN" != "$GITHUB_TOKEN" ]]; then
146+
# Save current token auth
147+
TEMP_AUTH=$(gh auth status 2>&1 | grep "Logged in")
148+
# Switch to personal token for org check
149+
echo "$PERSONAL_ACCESS_TOKEN" | gh auth login --with-token
150+
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$ISSUE_AUTHOR --silent -i || true)
151+
# Switch back to github token
152+
echo "$GITHUB_TOKEN" | gh auth login --with-token
153+
else
154+
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$ISSUE_AUTHOR --silent -i || true)
155+
fi
156+
144157
STATUS_CODE=$(echo "$ORG_CHECK" | head -n 1 | cut -d' ' -f2)
145158

146159
if [[ "$STATUS_CODE" != "204" ]]; then

0 commit comments

Comments
 (0)