Skip to content

fix(sync): keep private workflows when the merge has conflicts - #23

Merged
aidandaly24 merged 1 commit into
mainfrom
fix/sync-keep-workflows-on-conflict
Nov 11, 2026
Merged

aidandaly24 merged 1 commit into
mainfrom
fix/sync-keep-workflows-on-conflict

Conversation

@jariy17

@jariy17 jariy17 commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Problem

reusable-sync-from-public.yml keeps the caller's own .github/workflows/ by running git restore --source=HEAD --staged --worktree -- .github/workflows/ after the merge. On the conflict path, git restore refuses unmerged paths (error: path '...' is unmerged). The script runs without set -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 runs git rm -r -f on .github/workflows/ and then git checkout HEAD -- .github/workflows/. git rm -f clears 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.

@jariy17
jariy17 requested a review from a team November 11, 2026 00:51
@aidandaly24
aidandaly24 merged commit 936c376 into main Nov 11, 2026
2 checks passed
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