From 2e640683a819a0a4261ff2e635e15f09ae081284 Mon Sep 17 00:00:00 2001 From: Andreas Raeder Date: Wed, 29 Jul 2026 10:55:42 +0200 Subject: [PATCH 1/3] ci(release): push release commit via github app token to satisfy branch ruleset --- .github/workflows/on-release-main.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on-release-main.yml b/.github/workflows/on-release-main.yml index a626e89..df60c26 100644 --- a/.github/workflows/on-release-main.yml +++ b/.github/workflows/on-release-main.yml @@ -20,11 +20,19 @@ jobs: released: ${{ steps.version.outputs.released }} version: ${{ steps.version.outputs.version }} steps: + - name: Generate app token + id: app-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.RELEASE_APP_ID }} + private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + - name: Check out uses: actions/checkout@v4 with: fetch-depth: 0 # full history + tags so PSR can analyze commits ref: main + token: ${{ steps.app-token.outputs.token }} # app identity bypasses the main ruleset - name: Set up the environment uses: ./.github/actions/setup-python-env @@ -37,7 +45,7 @@ jobs: - name: Semantic release version id: version env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.app-token.outputs.token }} run: | before=$(git rev-parse HEAD) uv run semantic-release version From 92d410104d539236b4fc34bb7a5b02925ab98a81 Mon Sep 17 00:00:00 2001 From: Andreas Raeder Date: Wed, 29 Jul 2026 11:11:56 +0200 Subject: [PATCH 2/3] ci: make version-preview evaluate on main so PR bump shows correctly --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d08745..7b94baf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -90,6 +90,9 @@ jobs: - name: Compute release preview id: preview run: | + # PSR only computes a release on the main branch; name the checked-out + # PR head 'main' so the preview reflects what a merge would release. + git checkout -B main >/dev/null 2>&1 || true current=$(uv version --short 2>/dev/null || echo "unknown") next=$(uv run semantic-release version --print 2>/dev/null || echo "") if [ -n "$next" ] && [ "$next" != "$current" ]; then From 4db8800177b077610543dea1c7d3120ac8b31dfa Mon Sep 17 00:00:00 2001 From: Andreas Raeder Date: Wed, 29 Jul 2026 11:21:04 +0200 Subject: [PATCH 3/3] ci: fix version-preview to show bump and changelog, v-prefixed and reworded --- .github/workflows/main.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b94baf..b9fa083 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -102,9 +102,14 @@ jobs: fi echo "current=$current" >> "$GITHUB_OUTPUT" echo "next=$next" >> "$GITHUB_OUTPUT" + # Stamp the upcoming changelog section locally (no commit/tag/push/build) + # so the preview shows the notes this merge would add. + if [ -n "$next" ] && [ "$next" != "$current" ]; then + uv run semantic-release version --no-commit --no-tag --no-push --no-vcs-release --skip-build >/dev/null 2>&1 || true + fi { echo "changelog</dev/null | head -60 || echo "(no changelog preview)" + git --no-pager diff HEAD -- CHANGELOG.md | awk '/^\+/ && !/^\+\+\+/ {sub(/^\+/,""); print}' | head -80 echo "PSR_EOF" } >> "$GITHUB_OUTPUT" @@ -115,7 +120,7 @@ jobs: message: | ## Release preview - ${{ steps.preview.outputs.released == 'true' && format('Merging this PR would release **v{0}** (current: `{1}`).', steps.preview.outputs.next, steps.preview.outputs.current) || format('No version bump from the current commits (stays at `{0}`). Use conventional commit types (`feat`, `fix`, ...) to trigger a release.', steps.preview.outputs.current) }} + ${{ steps.preview.outputs.released == 'true' && format('Merging this PR would release **v{0}** (current: `v{1}`).', steps.preview.outputs.next, steps.preview.outputs.current) || format('No version bump from the current commits (stays at `v{0}`). Use conventional commit types (`feat`, `fix`, ...) to trigger a release.', steps.preview.outputs.current) }}
Changelog preview (truncated) @@ -125,7 +130,7 @@ jobs:
- Computed by python-semantic-release from the conventional commits on this branch. + Preview via python-semantic-release and conventional commits. benchmark: runs-on: ubuntu-latest