@@ -148,10 +148,28 @@ jobs:
148148 echo "::set-output name=title::$PR_TITLE"
149149 echo "pr title is: $PR_TITLE"
150150
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+ uses : paul1k/check-pr-labels@v1.0.0
161+ with :
162+ github-token : ${{ secrets.GITHUB_TOKEN }}
163+ pull-number : ${{ fromJSON(needs.get_pr_info.outputs.pr_number) }}
164+ labels : ' ["bot-updated"]'
165+
151166 generate_changelog :
152167 name : Generate changelog
153168 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 }}
155173 steps :
156174 - name : Checkout
157175 uses : actions/checkout@v3
@@ -202,15 +220,33 @@ jobs:
202220 # possibly using labels on PR
203221 generate_msrv :
204222 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 }}
206226 runs-on : ubuntu-latest
207227 steps :
208228 - name : Checkout
209229 uses : actions/checkout@v3
230+
231+ - name : rust-toolchain
232+ uses : actions-rs/toolchain@v1.0.6
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/actions-msrv@v0.2
210242 - name : Get Minimum Supported Rust Version
211- uses : spenserblack/actions-msrv@v0.2
212243 id : get-msrv
213244 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+
214250 - name : Create Badge
215251 run : curl https://img.shields.io/badge/rustc-${{ steps.get-msrv.outputs.msrv }}%2B-blue?logo=rust -o msrv-badge.svg
216252 - uses : actions/upload-artifact@v3
@@ -220,12 +256,14 @@ jobs:
220256
221257 commit_updates :
222258 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'
224260 runs-on : ubuntu-latest
225261 needs :
226262 - get_pr_info
227263 - generate_changelog
228264 - generate_msrv
265+ - bot-label-check
266+ if : ${{ needs.bot-label-check.outputs.label-exists }}
229267 permissions :
230268 contents : write
231269 pull-requests : write
@@ -281,6 +319,8 @@ jobs:
281319 commit_author : ${{ env.GIT_BOT_USERNAME }} <${{ env.GIT_BOT_EMAIL }}>
282320
283321 # 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.
284324 - name : Wait, then restart Bors and label PR
285325 if : ${{ steps.auto-commit-action.outputs.changes_detected == 'true' }}
286326 env :
0 commit comments