Problem Description
The Version Bump workflow fails when trying to push the version-bump branch because it already exists from a previous run.
Error Message
! [rejected] version-bump/v1.2.0 -> version-bump/v1.2.0 (non-fast-forward)
error: failed to push some refs to 'https://github.com/trsdn/markitdown-mcp'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart.
Root Cause
The workflow creates a branch version-bump/v{version} but doesn't handle the case where this branch already exists from a previous failed or successful run.
Current Code Issue
The workflow always tries to create and push a new branch without checking if it exists:
git checkout -b "$BRANCH_NAME"
git push origin "$BRANCH_NAME"
Proposed Solution
Option 1: Delete existing branch first
- name: Create version bump branch
run: |
BRANCH_NAME="version-bump/v$NEW_VERSION"
# Delete remote branch if it exists
git push origin --delete "$BRANCH_NAME" 2>/dev/null || true
# Create fresh branch
git checkout -b "$BRANCH_NAME"
Option 2: Use timestamp in branch name
BRANCH_NAME="version-bump/v$NEW_VERSION-$(date +%s)"
Option 3: Force push
git push --force origin "$BRANCH_NAME"
Option 4: Check and update existing branch
# Fetch remote branches
git fetch origin
# Check if branch exists
if git show-ref --verify --quiet refs/remotes/origin/"$BRANCH_NAME"; then
git checkout "$BRANCH_NAME"
git pull origin "$BRANCH_NAME"
git merge main
else
git checkout -b "$BRANCH_NAME"
fi
Impact
- Version bump PRs cannot be created
- Automated release process is broken
- Manual intervention required to delete existing branches
Test Case
Found in PR #16 where version bump workflow tries to create v1.2.0 branch that already exists.
Priority
Medium - Affects automated releases but has manual workaround.
Files Affected
.github/workflows/version-bump.yml
Problem Description
The Version Bump workflow fails when trying to push the version-bump branch because it already exists from a previous run.
Error Message
Root Cause
The workflow creates a branch
version-bump/v{version}but doesn't handle the case where this branch already exists from a previous failed or successful run.Current Code Issue
The workflow always tries to create and push a new branch without checking if it exists:
Proposed Solution
Option 1: Delete existing branch first
Option 2: Use timestamp in branch name
BRANCH_NAME="version-bump/v$NEW_VERSION-$(date +%s)"Option 3: Force push
git push --force origin "$BRANCH_NAME"Option 4: Check and update existing branch
Impact
Test Case
Found in PR #16 where version bump workflow tries to create v1.2.0 branch that already exists.
Priority
Medium - Affects automated releases but has manual workaround.
Files Affected
.github/workflows/version-bump.yml