Skip to content

Commit 50a0cc9

Browse files
authored
Merge pull request #32 from RalfJung/cronjob
have the cron job create rustup PRs automatically
2 parents 6798c27 + ba85414 commit 50a0cc9

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ on:
66
push:
77
branches: ['master']
88
schedule:
9-
- cron: '00 2 * * *' # At 02:00 UTC every day (like rustup-components-history).
9+
- cron: '10 2 * * *' # At 02:10 UTC every day (a bit after rustup-components-history).
10+
- cron: '20,35,50 9,10 * * *' # for testing
1011

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

73+
# Make a PR to update `rust-version` when the cron job succeeds.
74+
# The primary reason for this is that Github stops running our cron job
75+
# if there is no repo activity for a while, so we use these PRs to generate activity.
76+
cron-success-pr:
77+
name: automatic rustup PR
78+
runs-on: ubuntu-latest
79+
needs: [success]
80+
if: github.event_name == 'schedule'
81+
steps:
82+
- name: setup bot git name and email
83+
run: |
84+
git config --global user.name 'The Miri Conjob Bot'
85+
git config --global user.email '[email protected]'
86+
- name: Create PR
87+
run: |
88+
# Create commit
89+
DATE=$(date -u +%Y-%m-%d)
90+
echo "nightly-$DATE" > rust-version
91+
git commit -am "automatic rustup"
92+
# Switch to a PR branch
93+
BRANCH="rustup-$DATE"
94+
git switch -c $BRANCH
95+
git push -u origin $BRANCH
96+
# Create PR
97+
gh pr create -B master --title 'Automatic Rustup' --body ''
98+
7299
# Send a Zulip notification when a cron job fails
73100
cron-fail-notify:
74101
name: cronjob failure notification

0 commit comments

Comments
 (0)