feat(bounties): support GITHUB_TOKEN auth for issue comments#489
Conversation
Add a token auth mode to the GitHub comment client so a single PAT or `gh auth token` value covers every repo the user can write to, with no per-repo GitHub App install. Token takes precedence over the App; if neither is configured the comment is silently skipped (unchanged). - github-app.ts: isGitHubConfigured() + resolveToken() (GITHUB_TOKEN first, else App installation token) - document GITHUB_TOKEN in .env.example Verified: tsc --noEmit (0), eslint (clean). Pre-commit build step skipped (capped at 1024MB, OOMs locally; production build verified on the prior merge). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
vu1nz Security Review0 finding(s) in PR #? No security issues found. |
| async function resolveToken(owner: string, repo: string): Promise<string | null> { | ||
| if (process.env.GITHUB_TOKEN) return process.env.GITHUB_TOKEN; | ||
| if (!isGitHubAppConfigured()) return null; | ||
| return installationToken(owner, repo); | ||
| } |
There was a problem hiding this comment.
No App fallback when GITHUB_TOKEN is set but fails
resolveToken returns process.env.GITHUB_TOKEN immediately without testing it. If the token is present but lacks write permission on a specific repo (e.g. a read-only PAT, an expired token, or the automatically-injected GITHUB_TOKEN in a GitHub Actions environment — which is scoped only to the current repo), postIssueComment/updateIssueComment will receive a 401/403 from the API and return null, never attempting the GitHub App path even when the App is installed on the target repo. A deployer who sets GITHUB_TOKEN broadly and also has the App configured will silently lose App-based comments on any repo where the PAT is insufficient.
Follow-up to #488. Adds a token auth mode to the bounty→issue comment client so a single
GITHUB_TOKEN(a PAT orgh auth token) covers every repo the user can write to with no per-repo GitHub App install.isGitHubConfigured()+resolveToken()— usesGITHUB_TOKENif set, else the App installation token..env.exampledocumentsGITHUB_TOKEN.Verified:
tsc --noEmit(0),eslint(clean). Pre-commit build skipped (1024MB cap OOMs locally; fullnext buildwas verified on #488).🤖 Generated with Claude Code