@@ -13,6 +13,7 @@ FEEDBACK=$7
1313REQUIRE_ORG_MEMBERSHIP=${8:- " true" }
1414ORGANIZATION=${9:- $REPO_OWNER }
1515PERSONAL_ACCESS_TOKEN=${10:- $GITHUB_TOKEN }
16+ COMMENT_AUTHOR=${11:- " " }
1617
1718# Enable debug mode if requested
1819if [[ " $DEBUG_MODE " == " true" ]]; then
@@ -108,25 +109,34 @@ ISSUE_AUTHOR=$(echo "$ISSUE_DETAILS" | jq -r '.author.login')
108109
109110# Check if user is a member of the organization if required
110111if [[ " $REQUIRE_ORG_MEMBERSHIP " == " true" ]]; then
111- echo " Checking if $ISSUE_AUTHOR is a member of organization $ORGANIZATION "
112+ # Use the comment author for the org membership check if provided, otherwise fall back to issue author
113+ CHECK_USER=" ${COMMENT_AUTHOR:- $ISSUE_AUTHOR } "
114+ echo " Checking if $CHECK_USER is a member of organization $ORGANIZATION "
115+
116+ # Debug output
117+ echo " Comment Author: $COMMENT_AUTHOR "
118+ echo " Issue Author: $ISSUE_AUTHOR "
119+ echo " User being checked: $CHECK_USER "
112120
113121 # Temporarily use the personal access token for org membership check if provided
114122 if [[ " $PERSONAL_ACCESS_TOKEN " != " $GITHUB_TOKEN " ]]; then
123+ echo " Using Personal Access Token for organization membership check"
115124 # Save current token auth
116125 TEMP_AUTH=$( gh auth status 2>&1 | grep " Logged in" )
117126 # Switch to personal token for org check
118127 echo " $PERSONAL_ACCESS_TOKEN " | gh auth login --with-token
119- ORG_CHECK=$( gh api -X GET /orgs/$ORGANIZATION /members/$ISSUE_AUTHOR --silent -i || true)
128+ ORG_CHECK=$( gh api -X GET /orgs/$ORGANIZATION /members/$CHECK_USER --silent -i || true)
120129 # Switch back to github token
121130 echo " $GITHUB_TOKEN " | gh auth login --with-token
122131 else
123- ORG_CHECK=$( gh api -X GET /orgs/$ORGANIZATION /members/$ISSUE_AUTHOR --silent -i || true)
132+ echo " Using GitHub Token for organization membership check"
133+ ORG_CHECK=$( gh api -X GET /orgs/$ORGANIZATION /members/$CHECK_USER --silent -i || true)
124134 fi
125135
126136 STATUS_CODE=$( echo " $ORG_CHECK " | head -n 1 | cut -d' ' -f2)
127137
128138 if [[ " $STATUS_CODE " != " 204" ]]; then
129- echo " User $ISSUE_AUTHOR is not a member of organization $ORGANIZATION . Skipping Claude analysis."
139+ echo " User $CHECK_USER is not a member of organization $ORGANIZATION . Skipping Claude analysis."
130140
131141 # Leave a comment on the issue explaining why the analysis is skipped
132142 ISSUE_COMMENT=$( cat << EOF
147157 echo " Exiting due to non-organization member request"
148158 exit 0
149159 else
150- echo " User $ISSUE_AUTHOR is a member of organization $ORGANIZATION . Proceeding with Claude analysis."
160+ echo " User $CHECK_USER is a member of organization $ORGANIZATION . Proceeding with Claude analysis."
151161 fi
152162fi
153163
0 commit comments