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