Skip to content

Commit a9b590b

Browse files
authored
Unrolled build for rust-lang#122698
Rollup merge of rust-lang#122698 - clubby789:cancel-hourly-update, r=Mark-Simulacrum Cancel `cargo update` job if there's no updates Previously there were always updates so we didn't hit this. Since rust-lang#122489, this job runs on a more frequent schedule and causes errors if there have been no changes in that timespan. This led to a weird error on rust-lang#122646 (comment) - because of this I've replaced the `exit 1`s here with `gh run cancel` so we don't have false 'failed' jobs in the logs.
2 parents d6eb0f5 + 986f23e commit a9b590b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/dependencies.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
4343
# Exit with error if open and S-waiting-on-bors
4444
if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then
45-
exit 1
45+
gh run cancel ${{ github.run_id }}
4646
fi
4747
4848
update:
@@ -65,7 +65,10 @@ jobs:
6565
6666
- name: cargo update
6767
# Remove first line that always just says "Updating crates.io index"
68-
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
68+
# If there are no changes, cancel the job here
69+
run: |
70+
cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
71+
git status --porcelain | grep -q Cargo.lock || gh run cancel ${{ github.run_id }}
6972
- name: upload Cargo.lock artifact for use in PR
7073
uses: actions/upload-artifact@v3
7174
with:
@@ -131,7 +134,7 @@ jobs:
131134
# Exit with error if PR is closed
132135
STATE=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json state --jq '.state')
133136
if [[ "$STATE" != "OPEN" ]]; then
134-
exit 1
137+
gh run cancel ${{ github.run_id }}
135138
fi
136139
137140
gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY

0 commit comments

Comments
 (0)