6
6
branches :
7
7
- ' master'
8
8
schedule :
9
- - cron : ' 44 4 * * *' # At 4:44 UTC every day.
9
+ - cron : ' 44 4,17 * * *' # At 4:44 UTC every day.
10
10
11
11
defaults :
12
12
run :
@@ -89,41 +89,16 @@ jobs:
89
89
# Check if all jobs that we depend on (in the needs array) were successful.
90
90
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
91
91
92
- cron-fail-notify :
93
- name : cronjob failure notification
92
+ cron-rustc-pull :
93
+ name : automatic pull from rustc
94
94
runs-on : ubuntu-latest
95
95
permissions :
96
96
# The cronjob needs to be able to push to the repo...
97
97
contents : write
98
98
# ... and create a PR.
99
99
pull-requests : write
100
- needs : [build, style, coverage]
101
- if : ${{ github.event_name == 'schedule' && failure() }}
100
+ if : ${{ github.event_name == 'schedule' }}
102
101
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
127
102
- uses : actions/checkout@v4
128
103
with :
129
104
fetch-depth : 256 # get a bit more of the history
@@ -143,18 +118,45 @@ jobs:
143
118
run : |
144
119
./miri toolchain
145
120
./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
147
122
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.
148
126
BRANCH="rustup-$(date -u +%Y-%m-%d)"
149
127
git switch -c $BRANCH
150
128
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.'
157
130
env :
158
131
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
159
132
ZULIP_BOT_EMAIL : ${{ secrets.ZULIP_BOT_EMAIL }}
160
133
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