Skip to content

Commit b54a2fb

Browse files
committed
Don't use rebase
1 parent 3e8a479 commit b54a2fb

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/update-subtree.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,20 @@ jobs:
7070
cd ../verify-rust-std
7171
git remote add rust-filtered ../rust-tmp/
7272
git fetch rust-filtered
73-
git checkout -b update-subtree/library rust-filtered/subtree/library
74-
git rebase origin/subtree/library
73+
git checkout -t -b update-subtree/library origin/subtree/library
74+
SUBTREE_HEAD_MSG=$(git log --format=%s -n 1 origin/subtree/library)
75+
UPSTREAM_FROM=$(git log --grep="${SUBTREE_HEAD_MSG}" -n 1 --format=%H rust-filtered/subtree/library)
76+
UPSTREAM_HEAD=$(git log --format=%H -n 1 rust-filtered/subtree/library)
77+
if [ "${UPSTREAM_HEAD}" = "${UPSTREAM_FROM}" ]; then
78+
echo "Nothing to cherry-pick, ${UPSTREAM_FROM} matches ${UPSTREAM_HEAD} (${SUBTREE_HEAD_MSG})"
79+
echo "MERGE_CONFLICTS=noop" >> $GITHUB_ENV
80+
else
81+
git cherry-pick ${UPSTREAM_FROM}..rust-filtered/subtree/library; then
82+
echo "MERGE_CONFLICTS=maybe" >> $GITHUB_ENV
83+
fi
7584
7685
- name: Create Pull Request
86+
if: ${{ env.MERGE_CONFLICTS != 'noop' }}
7787
uses: peter-evans/create-pull-request@v7
7888
with:
7989
title: 'Update subtree/library'
@@ -86,6 +96,7 @@ jobs:
8696
path: verify-rust-std
8797

8898
- name: Merge subtree/library changes
99+
if: ${{ env.MERGE_CONFLICTS != 'noop' }}
89100
run: |
90101
cd verify-rust-std
91102
SYNC_BRANCH="sync-$TOOLCHAIN_DATE"

0 commit comments

Comments
 (0)