Skip to content

Commit 6519b28

Browse files
ci: Fix post merge lint (#45)
Hopefully last of the large CI changes for a while... Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 503a121 commit 6519b28

File tree

5 files changed

+48
-6
lines changed

5 files changed

+48
-6
lines changed

.github/assets/msrv-badge.svg

Lines changed: 1 addition & 1 deletion
Loading

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ jobs:
105105
# message: "[skip ci] Update CHANGELOG from Github Actions"
106106

107107
update-project-stuff:
108+
if: github.event_name == 'push' && github.ref == 'refs/heads/staging'
108109
uses: ./.github/workflows/update-repo-stuff.yml
109110
secrets: inherit
110111

.github/workflows/lint_pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ jobs:
1717
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1818
with:
1919
ignoreLabels: |
20-
bot
20+
bot-updated
2121
ignore-semantic-pull-request

.github/workflows/update-repo-stuff.yml

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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/[email protected]
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/[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]
210242
- name: Get Minimum Supported Rust Version
211-
uses: spenserblack/[email protected]
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:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
- Fix post pr workflow ([#37](https://github.com/tjtelan/git-url-parse-rs/issues/37))
2222
- Post PR: Include all PR files with changelog commit with `--all` ([#38](https://github.com/tjtelan/git-url-parse-rs/issues/38))
2323
- Add dependency for update job completion before Bors merges ([#43](https://github.com/tjtelan/git-url-parse-rs/issues/43))
24+
- Fix post merge lint ([#45](https://github.com/tjtelan/git-url-parse-rs/issues/45))
2425

2526
### Other
2627

0 commit comments

Comments
 (0)