Open-source personal finance manager. Self-hosted, privacy-first.
fix: fail early when the release branch already exists (#627)
Tássio Noronha3e75be069c6c
diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.ymlindex 80422ddf..d8d27017 100644--- a/.github/workflows/prepare-release.yml+++ b/.github/workflows/prepare-release.yml@@ -53,7 +53,16 @@ jobs:exit 1fi+ # An abandoned attempt leaves the branch behind (closing a PR does not+ # delete it), and the push would then be rejected after all the work.+ BRANCH="chore/release-v$VERSION"+ if git ls-remote --exit-code --heads origin "refs/heads/$BRANCH" >/dev/null 2>&1; then+ echo "::error::branch $BRANCH already exists. Delete it first: git push origin --delete $BRANCH"+ exit 1+ fi+echo "VERSION=$VERSION" >> "$GITHUB_ENV"+ echo "BRANCH=$BRANCH" >> "$GITHUB_ENV"- name: Bump version filesrun: |@@ -110,8 +119,6 @@ jobs:run: |set -euo pipefail- BRANCH="chore/release-v$VERSION"-git config user.name "github-actions[bot]"git config user.email "41898282+github-actions[bot]@users.noreply.github.com"git switch -c "$BRANCH"