From 5e98eca91e92d3c7af1c05548626da46cc49f3cd Mon Sep 17 00:00:00 2001 From: MRyutaro Date: Sun, 14 Jun 2026 23:12:44 +0900 Subject: [PATCH] =?UTF-8?q?ci:=20auto-format=E3=81=AEdetached=20HEAD=20pus?= =?UTF-8?q?h=E3=82=92=E4=BF=AE=E6=AD=A3=20(#36)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .github/workflows/format-python-code.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/format-python-code.yml b/.github/workflows/format-python-code.yml index 6473037..9bb2faa 100644 --- a/.github/workflows/format-python-code.yml +++ b/.github/workflows/format-python-code.yml @@ -20,6 +20,10 @@ jobs: uses: actions/checkout@v6 with: token: ${{ secrets.GITHUB_TOKEN }} + # pull_request ではマージ commit が detached HEAD でチェックアウトされ + # git push が失敗する。PR の元ブランチを明示してブランチ状態にする。 + # push(main)イベント時は github.head_ref が空なので既定の挙動になる。 + ref: ${{ github.head_ref }} - name: Set up Python uses: actions/setup-python@v6