Skip to content

Commit ce3aa02

Browse files
committed
Subtree update automation: create merge PR even when subtree/library is up-to-date
When the PR updating the `subtree/library` branch has been merged already we may still need to bring updates into `main` that haven't previously been added to a pull request. This situation arises when an older merge-into-main PR was still open at the time where the subtree automation creating the `subtree/library` update PR ran. The changes in this PR avoid this problem by making sure the merge-into-main part of the automation is run even when `subtree/library` is already up-to-date.
1 parent 659982c commit ce3aa02

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

.github/workflows/update-subtree.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ jobs:
126126
UPSTREAM_HEAD=$(git log --format=%H -n 1 rust-filtered/subtree/library)
127127
if [ "${UPSTREAM_HEAD}" = "${UPSTREAM_FROM}" ]; then
128128
echo "Nothing to do, ${UPSTREAM_FROM} matches ${UPSTREAM_HEAD} (${SUBTREE_HEAD_MSG})"
129-
echo "MERGE_CONFLICTS=noop" >> $GITHUB_ENV
129+
echo "SUBTREE_PR_REQUIRED=no" >> $GITHUB_ENV
130130
else
131131
git branch --set-upstream-to=origin/subtree/library
132-
echo "MERGE_CONFLICTS=maybe" >> $GITHUB_ENV
132+
echo "SUBTREE_PR_REQUIRED=yes" >> $GITHUB_ENV
133133
fi
134134
135135
- name: Create Pull Request to update subtree/library
136-
if: ${{ env.MERGE_CONFLICTS != 'noop' && env.SUBTREE_PR_EXISTS == 'no' }}
136+
if: ${{ env.SUBTREE_PR_REQUIRED == 'yes' && env.SUBTREE_PR_EXISTS == 'no' }}
137137
uses: peter-evans/create-pull-request@v7
138138
with:
139139
title: 'Update subtree/library to ${{ env.NEXT_TOOLCHAIN_DATE }}'
@@ -151,7 +151,7 @@ jobs:
151151
path: verify-rust-std
152152

153153
- name: Merge subtree/library changes
154-
if: ${{ env.MERGE_CONFLICTS != 'noop' && env.MERGE_PR_EXISTS == 'no' }}
154+
if: ${{ env.CURRENT_TOOLCHAIN_DATE != env.NEXT_TOOLCHAIN_DATE && env.MERGE_PR_EXISTS == 'no' }}
155155
run: |
156156
cd verify-rust-std
157157
# create-pull-request resets branches locally, implying that

0 commit comments

Comments
 (0)