Repository navigation
fix(sync): keep private workflows when the merge has conflicts - #23
Merged
Merged
Conversation
aidandaly24
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
reusable-sync-from-public.ymlkeeps the caller's own.github/workflows/by runninggit restore --source=HEAD --staged --worktree -- .github/workflows/after the merge. On the conflict path,git restorerefuses unmerged paths (error: path '...' is unmerged). The script runs withoutset -e, so the error is ignored: conflicted workflow files are committed with their conflict markers, and workflows that exist only upstream are added to the sync PR.Change
Both paths now call
keep_private_workflows, which runsgit rm -r -fon.github/workflows/and thengit checkout HEAD -- .github/workflows/.git rm -fclears unmerged entries, and the checkout restores the caller's versions exactly. Files that exist only upstream are dropped.Testing
Reproduced against a real conflicting merge with 11 unmerged workflow files. The old command failed on each file. The new pair left 0 workflow differences from
HEAD, 0 conflict markers, and 0 unmerged paths.Callers pin this workflow by SHA, so nothing changes until a caller bumps its pin.