From 6a7a1f94f970d463ef36daff7ccbb3e3af640f13 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Tue, 7 Oct 2025 10:51:41 +0200 Subject: [PATCH] Refactor branch handling in publish_release.yml Updated the workflow to handle branch deletion and creation more gracefully. --- .github/workflows/publish_release.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 0b72b4c..b3b4aef 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -35,13 +35,15 @@ jobs: - name: Create branch and commit VERSION run: | branch="update-version-${{ steps.draft.outputs.tag_name }}" - git checkout -b "$branch" + git push origin --delete "$branch" || echo "No remote branch to delete" + git fetch origin main + git checkout -b "$branch" origin/main echo "${{ steps.draft.outputs.tag_name }}" | sed 's/^v//' > VERSION git add VERSION git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}" || echo "No changes to commit" - git push --set-upstream origin "$branch" --force + git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}" + git push --set-upstream origin "$branch" - name: Create pull request