From 23aea364bbaa0f4fbb7ceb3e80ea283ee18ba1d2 Mon Sep 17 00:00:00 2001 From: Aaron <7063649+ahcodedev@users.noreply.github.com> Date: Thu, 19 Nov 2026 03:29:20 -0800 Subject: [PATCH] Fix release commit step in template Skip the version commit when pyproject.toml already has the release version, and authenticate the push since checkout doesn't persist credentials. --- template/.github/workflows/release.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/template/.github/workflows/release.yml b/template/.github/workflows/release.yml index d74ee47..85b93d5 100644 --- a/template/.github/workflows/release.yml +++ b/template/.github/workflows/release.yml @@ -42,12 +42,17 @@ jobs: id: commit env: TAG: ${{ steps.drafter.outputs.tag_name }} + GH_TOKEN: ${{ github.token }} run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add pyproject.toml uv.lock - git commit -m "Release $TAG" - git push origin main + # Skip the commit when pyproject.toml already has the release version + if ! git diff --quiet -- pyproject.toml uv.lock; then + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add pyproject.toml uv.lock + git commit -m "Release $TAG" + # Checkout doesn't persist credentials, so authenticate the push explicitly + git push "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:main + fi echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - name: Publish release