Repository navigation
ci: auto-formatのdetached HEAD pushを修正 (#36) - #39
Merged
Merged
Conversation
pull_requestイベントではactions/checkoutがマージcommitをdetached HEADで
チェックアウトするため、ワークフロー末尾のgit pushが
"You are not currently on a branch"で必ず失敗していた。
checkoutにref: ${{ github.head_ref }}を指定し、PRの元ブランチを
ブランチ状態でチェックアウトしてからpushするよう修正。
push(main)イベント時はgithub.head_refが空のため既定の挙動になり影響しない。
Closes #36
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
概要
.github/workflows/format-python-code.yml(auto-format)がpull_requestイベントで必ず失敗する問題(#36)を修正する。原因
pull_requestイベントではactions/checkoutがマージ commit を detached HEAD でチェックアウトするため、ワークフロー末尾のgit push(暗黙に現在ブランチを push)が以下で失敗していた:ファイル内容やフォーマット差分とは無関係な構造的問題で、どの PR でも再現する(main への
pushイベント時のみ成功)。修正内容
Issue の修正案 2 を採用。
actions/checkoutにref: ${{ github.head_ref }}を指定し、PR の元ブランチをブランチ状態でチェックアウトしてから push する。pull_request時:github.head_ref= PR の元ブランチ → ブランチ状態で checkout →git push成功push(main)時:github.head_refは空 → 既定の挙動になり影響なし自動整形運用を維持する方針(Q2)に沿った変更。
関連
🤖 Generated with Claude Code