Repository navigation
fix: Claude Assistant の push が 403 になる問題を回避 - #142
Merged
Merged
Conversation
actions/checkout@v6 は認証ヘッダーを includeIf.gitdir 経由で設定するが、 claude-code-action はこれを消せず、App トークンより GITHUB_TOKEN が優先される (anthropics/claude-code-action#1721)。persist-credentials: false にし、 ブランチ準備の fetch 用に GITHUB_TOKEN をリモート URL に設定する。 Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題
@claudeに修正を頼むと、Claude はローカルでコミットまではしますが、push が 403 で失敗します。(実例: hametuha/chiramise#8、run)
原因
actions/checkout@v6は GITHUB_TOKEN の認証ヘッダーをincludeIf.gitdir:経由の別ファイルに保存します。include.pathしか見ないので、このヘッダーを消せません。ログにはNo existing authentication headers to removeと出ています。contents: readだと、push が拒否されます。contents: writeを呼び出し側に足しても push は通るようになります。ただしその場合は GITHUB_TOKEN による push になり、CI や自動レビューが起動しません。そのため、この方法は採りませんでした。修正
persist-credentials: falseにして、認証ヘッダーを残さないようにします。git fetchを認証設定より前に実行するため、private リポジトリでも fetch できるようにする必要があります(claude-code-action fails when actions/checkout uses persist-credentials: false anthropics/claude-code-action#1236)。configureGitAuthが App トークン入りの URL で上書きします。そのため push は Claude アプリとして行われ、CI や自動レビューも起動します。影響
claude-assistant.ymlだけです。inputs は変えていません。確認
issue_commentで起動するワークフローは、main にある定義で動きます。そのため、マージ後に hametuha/chiramise#8 で@claudeに修正を頼み直し、次の2点を確認します。claude/issue-8-*ブランチが push されることactionlint は問題ありませんでした。
🤖 Generated with Claude Code