Skip to content
19 changes: 18 additions & 1 deletion .github/workflows/update-subtree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ jobs:
echo "CURRENT_COMMIT_HASH=${CURRENT_COMMIT_HASH}" >> $GITHUB_ENV
echo "NEXT_COMMIT_HASH=${NEXT_COMMIT_HASH}" >> $GITHUB_ENV

- name: Check for existing pull requests
run: |
cd verify-rust-std
if gh pr list --json title --jq '.[] | select(.title == "Update subtree/library to ${{ env.NEXT_TOOLCHAIN_DATE }}") | .title' | grep -q .; then
echo "SUBTREE_PR_EXISTS=yes" >> $GITHUB_ENV
else
echo "SUBTREE_PR_EXISTS=no" >> $GITHUB_ENV
fi
if gh pr list --json title --jq '.[] | select(.title == "Merge subtree update for toolchain nightly-${{ env.NEXT_TOOLCHAIN_DATE }}") | .title' | grep -q .; then
echo "MERGE_PR_EXISTS=yes" >> $GITHUB_ENV
else
echo "MERGE_PR_EXISTS=no" >> $GITHUB_ENV
fi
env:
GH_TOKEN: ${{ github.token }}

- name: Update subtree/library locally
run: |
cd rust-tmp
Expand All @@ -77,6 +93,7 @@ jobs:
git remote add rust-filtered ../rust-tmp/
git fetch rust-filtered
git checkout -b subtree/library rust-filtered/subtree/library
rm -rf library
SUBTREE_HEAD_MSG=$(git log --format=%s -n 1 origin/subtree/library)
UPSTREAM_FROM=$(git log --grep="${SUBTREE_HEAD_MSG}" -n 1 --format=%H rust-filtered/subtree/library)
UPSTREAM_HEAD=$(git log --format=%H -n 1 rust-filtered/subtree/library)
Expand Down Expand Up @@ -119,7 +136,7 @@ jobs:
echo "MERGE_CONFLICTS=no" >> $GITHUB_ENV
fi

sed -i "s/^channel = \"nightly-.*\"/channel = \"${NEXT_TOOLCHAIN_DATE}\"/" rust-toolchain.toml
sed -i "s/^channel = \"nightly-.*\"/channel = \"nightly-${NEXT_TOOLCHAIN_DATE}\"/" rust-toolchain.toml
git -c user.name=gitbot -c user.email=git@bot \
commit -m "Update toolchain to ${NEXT_TOOLCHAIN_DATE}" rust-toolchain.toml

Expand Down
Loading