Fix @claude push auth: use token URL instead of persisted credentials#106
Conversation
The "Push branch and open draft PR for issue trigger" step in claude.yml assumed actions/checkout's persisted GITHUB_TOKEN credential would still be present at push time, so it ran a plain `git push origin`. It isn't: the claude-code-action step that runs before it rewrites the repo's git auth config when setting up its own credentials, leaving the main repo with no `http.https://github.com/.extraheader`. The push then falls back to empty credentials and fails with "Password authentication is not supported" (run 26650131764 — the @claude attempt on issue #101 committed work but never opened a PR because of this). Push with an explicit token-bearing URL built from GITHUB_TOKEN (which has `contents: write` from the job's permissions block) so auth no longer depends on whatever the action left in git config. The downstream review is already dispatched explicitly via `gh workflow run`, so GITHUB_TOKEN's no-recursive-trigger behavior on the push doesn't drop the review. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude Code CLI (local session) is working on this — paws off until I'm done. |
|
Claude finished @d-morrison's task in 6m 43s —— View job Code Review
Verdict: LGTM on the push-auth fix. The PR's scope is larger than the description implies — worth being aware of before merging. Core fix (line 564)Correct. Scope mismatchThe PR description says "one push line + its comment" but the diff also:
These are intentional and appear correct, but they're architectural changes worth calling out explicitly. Dedup refactor trade-offThe old approach (post-step) was explicitly fail-open: if the marker was absent or a reaction call failed, the duplicate run simply proceeded. The new approach (Claude calling the API directly) has the same fail-open semantics in practice — a failed The removed "Dispatch review for late @claude review comment" step means a SecurityThe switch to URL-first Draft for a follow-up run if you want to address these findings: |
There was a problem hiding this comment.
Pull request overview
This PR fixes @claude workflow branch pushes by making authentication independent of actions/checkout’s persisted git credentials, which can be overwritten by anthropics/claude-code-action.
Changes:
- Replace
git push origin "$BRANCH"with an explicit token-bearing HTTPS URL usingGH_TOKEN(GITHUB_TOKEN) to ensure push auth succeeds even if git config is rewritten. - Update the surrounding workflow comment to document the failure mode (missing
http.https://github.com/.extraheader) and why downstream review dispatch is done viagh workflow run.
|
Why
@clauderun #26650131764 (the bot's attempt to implement #101) did its work and committed, but failed at the "Push branch and open draft PR for issue trigger" step with:So no draft PR was opened and the work was lost at runner cleanup.
Root cause
The push step assumed
actions/checkout's persisted GITHUB_TOKEN credential would still be present and ran a plaingit push origin. It isn't: theanthropics/claude-code-actionstep that runs before this one rewrites the repo's git auth config when it sets up its own credentials. The job-cleanup log confirms the main repo had nohttp.https://github.com/.extraheaderby the end (only themacrossubmodule did), so the push fell back to empty credentials.Fix
Push with an explicit token-bearing URL built from
GITHUB_TOKEN(which hascontents: writefrom the job'spermissions:block), so auth no longer depends on whatever the action left in git config:The downstream code review is already dispatched explicitly via
gh workflow run, so GITHUB_TOKEN's deliberate "no recursive workflow trigger on push" behavior doesn't drop the review.The stale comment that asserted a plain
git push originauthenticates is replaced with one documenting the real failure mode and the GITHUB_TOKEN trigger caveat.Scope
Workflow-only; one push line + its comment. Does not touch #101's actual doc task — that issue remains open and can be re-attempted once this lands.
🤖 Generated with Claude Code