Skip to content

Commit f90c125

Browse files
authored
Fix: delete existing release branch before creating new one (#60)
2 parents d1231c9 + 13829c7 commit f90c125

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

.github/workflows/auto-release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,17 @@ jobs:
9898
echo "✅ Tag '$TAG' does not exist"
9999
100100
- name: '🌿 Create release branch'
101+
env:
102+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101103
run: |
102104
BRANCH="${{ steps.version.outputs.branch_name }}"
105+
106+
# Delete existing release branch if it exists (from a previous failed run)
107+
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
108+
echo "ℹ️ Branch '$BRANCH' already exists, deleting it..."
109+
gh api -X DELETE "repos/${{ github.repository }}/git/refs/heads/$BRANCH" || true
110+
fi
111+
103112
git checkout -b "$BRANCH"
104113
105114
- name: '📝 Update version in TelegramDownloader.csproj'

0 commit comments

Comments
 (0)