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

Commit b348721

Browse files
committed
Stop using personal access token for organization membership checks
1 parent 7c8a192 commit b348721

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

scripts/issue-analyze-mode.sh

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,9 @@ if [[ "$REQUIRE_ORG_MEMBERSHIP" == "true" ]]; then
118118
echo "Issue Author: $ISSUE_AUTHOR"
119119
echo "User being checked: $CHECK_USER"
120120

121-
# Temporarily use the personal access token for org membership check if provided
122-
if [[ "$PERSONAL_ACCESS_TOKEN" != "$GITHUB_TOKEN" ]]; then
123-
echo "Using Personal Access Token for organization membership check"
124-
# Save current token auth
125-
TEMP_AUTH=$(gh auth status 2>&1 | grep "Logged in")
126-
# Switch to personal token for org check
127-
echo "$PERSONAL_ACCESS_TOKEN" | gh auth login --with-token
128-
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$CHECK_USER --silent -i || true)
129-
# Switch back to github token
130-
echo "$GITHUB_TOKEN" | gh auth login --with-token
131-
else
132-
echo "Using GitHub Token for organization membership check"
133-
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$CHECK_USER --silent -i || true)
134-
fi
121+
# Always use the GitHub token for org membership check
122+
echo "Using GitHub Token for organization membership check"
123+
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$CHECK_USER --silent -i || true)
135124

136125
STATUS_CODE=$(echo "$ORG_CHECK" | head -n 1 | cut -d' ' -f2)
137126

scripts/issue-fix-mode.sh

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,9 @@ if [[ "$REQUIRE_ORG_MEMBERSHIP" == "true" ]]; then
149149
echo "Issue Author: $ISSUE_AUTHOR"
150150
echo "User being checked: $CHECK_USER"
151151

152-
# Temporarily use the personal access token for org membership check if provided
153-
if [[ "$PERSONAL_ACCESS_TOKEN" != "$GITHUB_TOKEN" ]]; then
154-
echo "Using Personal Access Token for organization membership check"
155-
# Save current token auth
156-
TEMP_AUTH=$(gh auth status 2>&1 | grep "Logged in")
157-
# Switch to personal token for org check
158-
echo "$PERSONAL_ACCESS_TOKEN" | gh auth login --with-token
159-
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$CHECK_USER --silent -i || true)
160-
# Switch back to github token
161-
echo "$GITHUB_TOKEN" | gh auth login --with-token
162-
else
163-
echo "Using GitHub Token for organization membership check"
164-
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$CHECK_USER --silent -i || true)
165-
fi
152+
# Always use the GitHub token for org membership check
153+
echo "Using GitHub Token for organization membership check"
154+
ORG_CHECK=$(gh api -X GET /orgs/$ORGANIZATION/members/$CHECK_USER --silent -i || true)
166155

167156
STATUS_CODE=$(echo "$ORG_CHECK" | head -n 1 | cut -d' ' -f2)
168157

0 commit comments

Comments
 (0)