Skip to content

Commit 6a7a1f9

Browse files
Refactor branch handling in publish_release.yml
Updated the workflow to handle branch deletion and creation more gracefully.
1 parent b96b549 commit 6a7a1f9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/publish_release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ jobs:
3535
- name: Create branch and commit VERSION
3636
run: |
3737
branch="update-version-${{ steps.draft.outputs.tag_name }}"
38-
git checkout -b "$branch"
38+
git push origin --delete "$branch" || echo "No remote branch to delete"
39+
git fetch origin main
40+
git checkout -b "$branch" origin/main
3941
echo "${{ steps.draft.outputs.tag_name }}" | sed 's/^v//' > VERSION
4042
git add VERSION
4143
git config user.name "github-actions[bot]"
4244
git config user.email "github-actions[bot]@users.noreply.github.com"
43-
git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}" || echo "No changes to commit"
44-
git push --set-upstream origin "$branch" --force
45+
git commit -m "chore: add VERSION ${{ steps.draft.outputs.tag_name }}"
46+
git push --set-upstream origin "$branch"
4547
4648
4749
- name: Create pull request

0 commit comments

Comments
 (0)