Skip to content

Commit c9f0170

Browse files
authored
Fix: change github endpoint (#27)
Change bot identity detection endpoint to /app per GitHub documentation ([source](https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-the-authenticated-app))
1 parent ef1d525 commit c9f0170

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ runs:
215215
fi
216216
fi
217217
218-
# Method 2: Try installation endpoint (works for GitHub App tokens)
218+
# Method 2: Try /app endpoint (works for GitHub App tokens)
219219
if [ -z "$BOT_LOGIN" ]; then
220-
if INSTALLATION_DATA=$(gh api "repos/$GITHUB_REPOSITORY/installation" 2>/dev/null); then
221-
APP_SLUG=$(echo "$INSTALLATION_DATA" | jq -r '.app_slug // empty' 2>/dev/null)
220+
if APP_DATA=$(gh api app 2>/dev/null); then
221+
APP_SLUG=$(echo "$APP_DATA" | jq -r '.slug // empty' 2>/dev/null)
222222
if [ -n "$APP_SLUG" ] && [ "$APP_SLUG" != "null" ]; then
223223
BOT_LOGIN="${APP_SLUG}[bot]"
224-
echo "Detected bot via installation endpoint: $BOT_LOGIN"
224+
echo "Detected bot via /app endpoint: $BOT_LOGIN"
225225
fi
226226
fi
227227
fi

0 commit comments

Comments
 (0)