Skip to content

Commit e1afa44

Browse files
committed
Leave a comment on the PR letting devs know if they need to fix anything
1 parent c38aab9 commit e1afa44

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/rocm-nightly-upstream-sync.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,17 @@ jobs:
3838
- name: Create branch
3939
run: |
4040
git fetch
41-
git checkout origin/main
41+
git checkout origin/main
4242
git checkout -b $SYNC_BRANCH_NAME
4343
# Try and merge rocm-main into this new branch so that we don't run upstream's CI code
4444
git config --global user.email "[email protected]"
4545
git config --global user.name "GitHub Actions"
46-
git merge origin/rocm-main || true
47-
# If the merge creates conflicts, we want to abort and push to origin anyways so that a dev can resolve the conflicts
48-
git merge --abort || true
46+
if git merge origin/rocm-main --ff-only; then
47+
echo "Merged rocm-main into CI branch"
48+
echo "merged=1" >> "$GITHUB_OUTPUT"
49+
else
50+
echo "merged=0" >> "$GITHUB_OUTPUT"
51+
fi
4952
git push origin HEAD
5053
open-sync-pr:
5154
needs: create-sync-branch
@@ -61,6 +64,11 @@ jobs:
6164
run: |
6265
gh pr create --repo $GITHUB_REPOSITORY --head $SYNC_BRANCH_NAME --base rocm-main --title "CI: $(date +%x) upstream sync" --body "Daily sync with upstream"
6366
gh pr merge --repo $GITHUB_REPOSITORY --merge --auto $SYNC_BRANCH_NAME
67+
# If the merge failed, leave a comment on the PR telling devs how to fix it
68+
if [[ $MERGED == 0 ]]; then
69+
gh pr comment --repo $GITHUB_REPOSITORY --body "Merging of this branch with rocm-main has failed and must be resolved by a dev. In your local repo, please run git fetch origin; git checkout $SYNC_BRANCH_NAME; git merge rocm-main` and then git push origin $SYNC_BRANCH_MAIN once any conflicts have been resolved."
70+
fi
6471
env:
72+
MERGED: ${{ needs.create-sync-branch.outputs.merged }}
6573
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
6674

0 commit comments

Comments
 (0)