Skip to content

Commit

Permalink
Rollup merge of rust-lang#122698 - clubby789:cancel-hourly-update, r=…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
workingjubilee authored Mar 23, 2024
2 parents 79c39a2 + 986f23e commit be7fd03
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
# Exit with error if open and S-waiting-on-bors
if [[ "$STATE" == "OPEN" && "$WAITING_ON_BORS" == "true" ]]; then
exit 1
gh run cancel ${{ github.run_id }}
fi
update:
Expand All @@ -65,7 +65,10 @@ jobs:
- name: cargo update
# Remove first line that always just says "Updating crates.io index"
run: cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
# If there are no changes, cancel the job here
run: |
cargo update 2>&1 | sed '/crates.io index/d' | tee -a cargo_update.log
git status --porcelain | grep -q Cargo.lock || gh run cancel ${{ github.run_id }}
- name: upload Cargo.lock artifact for use in PR
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -131,7 +134,7 @@ jobs:
# Exit with error if PR is closed
STATE=$(gh pr view cargo_update --repo $GITHUB_REPOSITORY --json state --jq '.state')
if [[ "$STATE" != "OPEN" ]]; then
exit 1
gh run cancel ${{ github.run_id }}
fi
gh pr edit cargo_update --title "${PR_TITLE}" --body-file body.md --repo $GITHUB_REPOSITORY
Expand Down

0 comments on commit be7fd03

Please sign in to comment.