Skip to content

Commit 771b947

Browse files
committed
CI: Run lintcheck --fix in CI
1 parent 4fabd75 commit 771b947

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/lintcheck.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,46 @@ jobs:
132132
path: |
133133
full_diff.md
134134
truncated_diff.md
135+
136+
# Run lintcheck in fix mode to check that all suggestions are good. This only
137+
# runs on `clippy::all` + `clippy::pedantic` as lints and suggestions from these
138+
# categories generally not conflict and overlap.
139+
fix:
140+
runs-on: ubuntu-latest
141+
142+
steps:
143+
- name: Checkout
144+
uses: actions/checkout@v4
145+
with:
146+
fetch-depth: 2
147+
148+
# HEAD is the generated merge commit `refs/pull/N/merge` between the PR and `master`, `HEAD^`
149+
# being the commit from `master` that is the base of the merge
150+
- name: Checkout base
151+
run: git checkout HEAD^
152+
153+
# Use the lintcheck from the PR to generate the JSON in case the PR modifies lintcheck in some
154+
# way
155+
- name: Checkout current lintcheck
156+
run: |
157+
rm -rf lintcheck
158+
git checkout ${{ github.sha }} -- lintcheck
159+
160+
- name: Cache lintcheck bin
161+
id: cache-lintcheck-bin
162+
uses: actions/cache@v4
163+
with:
164+
path: target/debug/lintcheck
165+
key: lintcheck-bin-${{ hashfiles('lintcheck/**') }}
166+
167+
- name: Build lintcheck
168+
if: steps.cache-lintcheck-bin.outputs.cache-hit != 'true'
169+
run: cargo build --manifest-path=lintcheck/Cargo.toml
170+
171+
- name: Create cache key
172+
id: key
173+
run: echo "key=lintcheck-base-${{ hashfiles('lintcheck/**') }}-$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
174+
175+
- name: Run lintcheck
176+
if: steps.cache-json.outputs.cache-hit != 'true'
177+
run: ./target/debug/lintcheck --crates-toml ./lintcheck/ci_crates.toml --fix

0 commit comments

Comments
 (0)