66 branches :
77 - ' master'
88 schedule :
9- - cron : ' 44 4 * * *' # At 4:44 UTC every day.
9+ - cron : ' 44 4,17 * * *' # At 4:44 UTC every day.
1010
1111defaults :
1212 run :
@@ -89,41 +89,16 @@ jobs:
8989 # Check if all jobs that we depend on (in the needs array) were successful.
9090 jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
9191
92- cron-fail-notify :
93- name : cronjob failure notification
92+ cron-rustc-pull :
93+ name : automatic pull from rustc
9494 runs-on : ubuntu-latest
9595 permissions :
9696 # The cronjob needs to be able to push to the repo...
9797 contents : write
9898 # ... and create a PR.
9999 pull-requests : write
100- needs : [build, style, coverage]
101- if : ${{ github.event_name == 'schedule' && failure() }}
100+ if : ${{ github.event_name == 'schedule' }}
102101 steps :
103- # Send a Zulip notification
104- - name : Install zulip-send
105- run : pip3 install zulip
106- - name : Send Zulip notification
107- env :
108- ZULIP_BOT_EMAIL : ${{ secrets.ZULIP_BOT_EMAIL }}
109- ZULIP_API_TOKEN : ${{ secrets.ZULIP_API_TOKEN }}
110- run : |
111- ~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \
112- --stream miri --subject "Miri Build Failure ($(date -u +%Y-%m))" \
113- --message 'Dear @*T-miri*,
114-
115- It would appear that the [Miri cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed.
116-
117- This likely means that rustc changed the miri directory and
118- we now need to do a [`./miri rustc-pull`](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#importing-changes-from-the-rustc-repo).
119-
120- Would you mind investigating this issue?
121-
122- Thanks in advance!
123- Sincerely,
124- The Miri Cronjobs Bot'
125-
126- # Attempt to auto-sync with rustc
127102 - uses : actions/checkout@v4
128103 with :
129104 fetch-depth : 256 # get a bit more of the history
@@ -143,18 +118,45 @@ jobs:
143118 run : |
144119 ./miri toolchain
145120 ./miri fmt --check || (./miri fmt && git commit -am "fmt")
146- - name : Push changes to a branch
121+ - name : Push changes to a branch and create PR
147122 run : |
123+ # `git diff --exit-code` "succeeds" if the diff is empty.
124+ if git diff --exit-code HEAD^; then exit 0; fi
125+ # The diff is non-empty, create a PR.
148126 BRANCH="rustup-$(date -u +%Y-%m-%d)"
149127 git switch -c $BRANCH
150128 git push -u origin $BRANCH
151- - name : Create Pull Request
152- run : |
153- PR=$(gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.')
154- ~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \
155- --stream miri --subject "Miri Build Failure ($(date -u +%Y-%m))" \
156- --message "A PR doing a rustc-pull [has been automatically created]($PR) for your convenience."
129+ gh pr create -B master --title 'Automatic Rustup' --body 'Please close and re-open this PR to trigger CI, then enable auto-merge.'
157130 env :
158131 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
159132 ZULIP_BOT_EMAIL : ${{ secrets.ZULIP_BOT_EMAIL }}
160133 ZULIP_API_TOKEN : ${{ secrets.ZULIP_API_TOKEN }}
134+
135+ cron-fail-notify :
136+ name : cronjob failure notification
137+ runs-on : ubuntu-latest
138+ needs : [build, style, coverage]
139+ if : ${{ github.event_name == 'schedule' && failure() }}
140+ steps :
141+ # Send a Zulip notification
142+ - name : Install zulip-send
143+ run : pip3 install zulip
144+ - name : Send Zulip notification
145+ env :
146+ ZULIP_BOT_EMAIL : ${{ secrets.ZULIP_BOT_EMAIL }}
147+ ZULIP_API_TOKEN : ${{ secrets.ZULIP_API_TOKEN }}
148+ run : |
149+ ~/.local/bin/zulip-send --user $ZULIP_BOT_EMAIL --api-key $ZULIP_API_TOKEN --site https://rust-lang.zulipchat.com \
150+ --stream miri --subject "Miri Build Failure ($(date -u +%Y-%m))" \
151+ --message 'Dear @*T-miri*,
152+
153+ It would appear that the [Miri cron job build]('"https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"') failed.
154+
155+ This likely means that rustc changed the miri directory and
156+ we now need to do a [`./miri rustc-pull`](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#importing-changes-from-the-rustc-repo).
157+
158+ Would you mind investigating this issue?
159+
160+ Thanks in advance!
161+ Sincerely,
162+ The Miri Cronjobs Bot'
0 commit comments