Skip to content

Commit 339dbf7

Browse files
committed
Update CI workflow
1 parent 59ea58f commit 339dbf7

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,27 +147,40 @@ jobs:
147147
- uses: actions/checkout@v4
148148
with:
149149
fetch-depth: 256 # get a bit more of the history
150-
- name: install josh-proxy
151-
run: cargo +stable install josh-proxy --git https://github.com/josh-project/josh --tag r24.10.04
150+
- name: install josh-sync
151+
run: cargo +stable install --locked --git https://github.com/rust-lang/josh-sync
152152
- name: setup bot git name and email
153153
run: |
154154
git config --global user.name 'The Miri Cronjob Bot'
155155
git config --global user.email '[email protected]'
156156
- name: Install nightly toolchain
157157
run: rustup toolchain install nightly --profile minimal
158-
- name: get changes from rustc
159-
run: ./miri rustc-pull
160158
- name: Install rustup-toolchain-install-master
161159
run: cargo install -f rustup-toolchain-install-master
162-
- name: format changes (if any)
160+
- name: Push changes to a branch and create PR
163161
run: |
162+
# Temporarily disable early exit to examine the status code of rustc-josh-sync
163+
set +e
164+
rustc-josh-sync pull
165+
exitcode=$?
166+
set -e
167+
168+
# If there were no changes to pull, rustc-josh-sync returns status code 2
169+
# In that case skip the rest of the job
170+
if [ $exitcode -eq 2 ]; then
171+
echo "Nothing changed in rustc, skipping PR"
172+
exit 0
173+
elif [ $exitcode -ne 0 ]; then
174+
# If return code was not 0 or 2, rustc-josh-sync actually failed
175+
echo "rustc-josh-sync failed"
176+
exit ${exitcode}
177+
fi
178+
179+
# Format changes
164180
./miri toolchain
165181
./miri fmt --check || (./miri fmt && git commit -am "fmt")
166-
- name: Push changes to a branch and create PR
167-
run: |
168-
# `git diff --exit-code` "succeeds" if the diff is empty.
169-
if git diff --exit-code HEAD^; then echo "Nothing changed in rustc, skipping PR"; exit 0; fi
170-
# The diff is non-empty, create a PR.
182+
183+
# Create a PR
171184
BRANCH="rustup-$(date -u +%Y-%m-%d)"
172185
git switch -c $BRANCH
173186
git push -u origin $BRANCH

0 commit comments

Comments
 (0)