Skip to content

Commit

Permalink
Update sync-branches.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
schmittjoseph authored Jul 25, 2024
1 parent 2d040a8 commit 5b079df
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/sync-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
auth_token: ${{ secrets.GITHUB_TOKEN }}

sync-code:
if: github.repository == 'dotnet/dotnet-monitor'
# if: github.repository == 'dotnet/dotnet-monitor'
strategy:
matrix:
branch: ["feature/9.x"]
Expand All @@ -76,12 +76,22 @@ jobs:
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Activate the ours merge driver to respect any branch specific files
git config merge.ours.driver true
git merge "$base_branch" --strategy=ort --strategy-option=theirs
MERGE_RESULT=0
# Don't fail if the automatic merge fails, we'll try to handle it later
git merge "$base_branch" --strategy=ort --strategy-option=theirs || MERGE_RESULT=$?
# If the merge failed, try to restore all the branch specific files in the case of a modify/delete conflict.
# If the merge succeeded, we still do this to ensure that we discard any new files from the base branch if they exist in our branch-specific folders.
matches=$(perl -ne '/^([^\s]+)\s+merge=ours/gm && print "$1 "' .gitattributes)
for match in $matches; do
git checkout --no-overlay "$target_branch" -- "$match"
done
# If the merge failed, try to continue it now that we've restored the branch specific files
# If it still fails, human intervention is required
if [ MERGE_RESULT -ne 0 ]; then
git merge --continue
fi
env:
target_branch: origin/${{ matrix.branch }}

Expand Down

0 comments on commit 5b079df

Please sign in to comment.