From 569560bfdfbb16754c8b5c5c453335452db1a001 Mon Sep 17 00:00:00 2001 From: Fran Leustek Date: Sun, 25 Jan 2026 11:37:00 +0100 Subject: [PATCH 1/2] change the automated changelog workflow --- .github/workflows/create-tag-and-exit.yml | 34 +++++++++-------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/.github/workflows/create-tag-and-exit.yml b/.github/workflows/create-tag-and-exit.yml index a00fde1c..48bdd936 100644 --- a/.github/workflows/create-tag-and-exit.yml +++ b/.github/workflows/create-tag-and-exit.yml @@ -9,6 +9,7 @@ on: permissions: contents: write + pull-requests: write jobs: tag: @@ -73,7 +74,9 @@ jobs: echo "" done >> CHANGELOG.md - - name: Commit and push CHANGELOG.md + - name: Create PR for CHANGELOG.md update + env: + GH_TOKEN: ${{ github.token }} run: | git config user.name "github-actions" git config user.email "github-actions@github.com" @@ -82,25 +85,14 @@ jobs: echo "No changelog changes to commit" exit 0 fi + + BRANCH_NAME="chore/update-changelog-${{ steps.version.outputs.tag }}" + git checkout -b "$BRANCH_NAME" git commit -m "chore: update changelog for ${{ steps.version.outputs.tag }}" + git push origin "$BRANCH_NAME" - # Pull with rebase and push, with retry on failure - max_retries=3 - for i in $(seq 1 $max_retries); do - git fetch origin main - if ! git rebase origin/main; then - if git diff --name-only --diff-filter=U | grep -q .; then - echo "Rebase failed due to conflicts; aborting." - git rebase --abort - exit 1 - fi - echo "Rebase failed; aborting." - git rebase --abort || true - exit 1 - fi - git push origin main && exit 0 - echo "Push attempt $i failed, retrying..." - sleep 2 - done - echo "Failed to push after $max_retries attempts" - exit 1 + gh pr create \ + --title "chore: update changelog for ${{ steps.version.outputs.tag }}" \ + --body "Automated changelog update for release ${{ steps.version.outputs.tag }}" \ + --base main \ + --head "$BRANCH_NAME" From 309e4055648aab5ebfbd35a6433722ab1aeeea58 Mon Sep 17 00:00:00 2001 From: Fran Leustek Date: Sun, 25 Jan 2026 15:21:30 +0100 Subject: [PATCH 2/2] add push force with lease --- .github/workflows/create-tag-and-exit.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create-tag-and-exit.yml b/.github/workflows/create-tag-and-exit.yml index 48bdd936..50b77600 100644 --- a/.github/workflows/create-tag-and-exit.yml +++ b/.github/workflows/create-tag-and-exit.yml @@ -87,12 +87,17 @@ jobs: fi BRANCH_NAME="chore/update-changelog-${{ steps.version.outputs.tag }}" - git checkout -b "$BRANCH_NAME" + git checkout -B "$BRANCH_NAME" git commit -m "chore: update changelog for ${{ steps.version.outputs.tag }}" - git push origin "$BRANCH_NAME" + git push --force-with-lease origin "$BRANCH_NAME" - gh pr create \ - --title "chore: update changelog for ${{ steps.version.outputs.tag }}" \ - --body "Automated changelog update for release ${{ steps.version.outputs.tag }}" \ - --base main \ - --head "$BRANCH_NAME" + # Create PR only if one doesn't already exist for this branch + if gh pr view "$BRANCH_NAME" --json state -q '.state' 2>/dev/null | grep -q "OPEN"; then + echo "PR already exists for $BRANCH_NAME; skipping creation." + else + gh pr create \ + --title "chore: update changelog for ${{ steps.version.outputs.tag }}" \ + --body "Automated changelog update for release ${{ steps.version.outputs.tag }}" \ + --base main \ + --head "$BRANCH_NAME" + fi