@@ -148,10 +148,28 @@ jobs:
148
148
echo "::set-output name=title::$PR_TITLE"
149
149
echo "pr title is: $PR_TITLE"
150
150
151
+ bot-label-check :
152
+ name : Check if we've already done the hard work
153
+ runs-on : ubuntu-latest
154
+ needs : get_pr_info
155
+ outputs :
156
+ label-exists : ${{ steps.label-check.outputs.result }}
157
+ steps :
158
+ - name : Check if already labeled before running
159
+ id : label-check
160
+
161
+ with :
162
+ github-token : ${{ secrets.GITHUB_TOKEN }}
163
+ pull-number : ${{ fromJSON(needs.get_pr_info.outputs.pr_number) }}
164
+ labels : ' ["bot-updated"]'
165
+
151
166
generate_changelog :
152
167
name : Generate changelog
153
168
runs-on : ubuntu-latest
154
- needs : get_pr_info
169
+ needs :
170
+ - bot-label-check
171
+ - get_pr_info
172
+ if : ${{ needs.bot-label-check.outputs.label-exists }}
155
173
steps :
156
174
- name : Checkout
157
175
uses : actions/checkout@v3
@@ -202,15 +220,33 @@ jobs:
202
220
# possibly using labels on PR
203
221
generate_msrv :
204
222
name : Generate Minimum Supported Rust Version badge
205
- if : github.event_name == 'push' && github.ref == 'refs/heads/staging'
223
+ # if: github.event_name == 'push' && github.ref == 'refs/heads/staging'
224
+ needs : bot-label-check
225
+ if : ${{ needs.bot-label-check.outputs.label-exists }}
206
226
runs-on : ubuntu-latest
207
227
steps :
208
228
- name : Checkout
209
229
uses : actions/checkout@v3
230
+
231
+ - name : rust-toolchain
232
+ uses :
actions-rs/[email protected]
233
+ with :
234
+ profile : minimal
235
+ toolchain : stable
236
+ - uses : Swatinem/rust-cache@v2
237
+ - name : Install cargo-msrv
238
+ run : cargo install cargo-msrv
239
+
240
+ # I took this from entrypoint.sh
241
+ # from spenserblack/[email protected]
210
242
- name : Get Minimum Supported Rust Version
211
- uses :
spenserblack/[email protected]
212
243
id : get-msrv
213
244
timeout-minutes : 60
245
+ run : |
246
+ MSRV_RESULT=$(cargo msrv --path $1 --output-format json | tail -1)
247
+ MSRV=$(echo $MSRV_RESULT | jq -r '.msrv')
248
+ echo "::set-output name=msrv::$MSRV"
249
+
214
250
- name : Create Badge
215
251
run : curl https://img.shields.io/badge/rustc-${{ steps.get-msrv.outputs.msrv }}%2B-blue?logo=rust -o msrv-badge.svg
216
252
- uses : actions/upload-artifact@v3
@@ -220,12 +256,14 @@ jobs:
220
256
221
257
commit_updates :
222
258
name : Commit updates
223
- if : github.event_name == 'push' && github.ref == 'refs/heads/staging'
259
+ # if: github.event_name == 'push' && github.ref == 'refs/heads/staging'
224
260
runs-on : ubuntu-latest
225
261
needs :
226
262
- get_pr_info
227
263
- generate_changelog
228
264
- generate_msrv
265
+ - bot-label-check
266
+ if : ${{ needs.bot-label-check.outputs.label-exists }}
229
267
permissions :
230
268
contents : write
231
269
pull-requests : write
@@ -281,6 +319,8 @@ jobs:
281
319
commit_author : ${{ env.GIT_BOT_USERNAME }} <${{ env.GIT_BOT_EMAIL }}>
282
320
283
321
# Make sure labels are created first
322
+ # If you're using bors, remember to add your user as a reviewer
323
+ # Note: You can only add reviewer if `Synchronize` is None.
284
324
- name : Wait, then restart Bors and label PR
285
325
if : ${{ steps.auto-commit-action.outputs.changes_detected == 'true' }}
286
326
env :
0 commit comments