Skip to content

Skip branch sync when fork is ahead of upstream#209

Merged
mercyblitz merged 1 commit intomainfrom
copilot/update-sync-branches-workflow
Apr 11, 2026
Merged

Skip branch sync when fork is ahead of upstream#209
mercyblitz merged 1 commit intomainfrom
copilot/update-sync-branches-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

The sync workflow was force-pushing upstream state onto fork branches unconditionally when commits diverged, overwriting any fork-only commits.

  • Added a git merge-base --is-ancestor check: if the upstream commit is an ancestor of the fork's commit, the fork is strictly ahead and the sync is skipped
  • Branch is counted as skipped with a descriptive log message
# If the fork branch is ahead of upstream (upstream is an ancestor of origin), skip.
if git merge-base --is-ancestor "$upstream_sha" "$origin_sha"; then
  echo "Branch '${branch}' in fork is ahead of upstream – skipping."
  skipped=$((skipped + 1))
  continue
fi

@sonarqubecloud
Copy link
Copy Markdown

@mercyblitz mercyblitz merged commit dfdbd47 into main Apr 11, 2026
14 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mercyblitz mercyblitz deleted the copilot/update-sync-branches-workflow branch April 11, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants