Skip to content

have the cron job create rustup PRs automatically #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
push:
branches: ['master']
schedule:
- cron: '00 2 * * *' # At 02:00 UTC every day (like rustup-components-history).
- cron: '10 2 * * *' # At 02:10 UTC every day (a bit after rustup-components-history).
- cron: '20,35,50 9,10 * * *' # for testing

jobs:
test-core:
Expand Down Expand Up @@ -69,6 +70,32 @@ jobs:
- name: check if any dependency failed
run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'

# Make a PR to update `rust-version` when the cron job succeeds.
# The primary reason for this is that Github stops running our cron job
# if there is no repo activity for a while, so we use these PRs to generate activity.
cron-success-pr:
name: automatic rustup PR
runs-on: ubuntu-latest
needs: [success]
if: github.event_name == 'schedule'
steps:
- name: setup bot git name and email
run: |
git config --global user.name 'The Miri Conjob Bot'
git config --global user.email '[email protected]'
- name: Create PR
run: |
# Create commit
DATE=$(date -u +%Y-%m-%d)
echo "nightly-$DATE" > rust-version
git commit -am "automatic rustup"
# Switch to a PR branch
BRANCH="rustup-$DATE"
git switch -c $BRANCH
git push -u origin $BRANCH
# Create PR
gh pr create -B master --title 'Automatic Rustup' --body ''

# Send a Zulip notification when a cron job fails
cron-fail-notify:
name: cronjob failure notification
Expand Down