File tree Expand file tree Collapse file tree 2 files changed +66
-4
lines changed Expand file tree Collapse file tree 2 files changed +66
-4
lines changed Original file line number Diff line number Diff line change 1+ on :
2+ workflow_run :
3+ workflows : ["CI"]
4+ types :
5+ - completed
6+
7+ name : Auto format
8+
9+ concurrency :
10+ group : ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
11+ cancel-in-progress : true
12+
13+ jobs :
14+ auto_format_commit :
15+ permissions :
16+ contents : write
17+ pull-requests : write
18+ name : Auto-format code
19+ runs-on : ubuntu-latest
20+ if : ${{ github.event.workflow_run.conclusion == 'success' && !contains(github.event.workflow_run.head_commit.message, '[skip ci]') }}
21+ concurrency :
22+ group : fmt-${{ github.event.workflow_run.head_branch }}
23+ cancel-in-progress : true
24+
25+ steps :
26+ - name : Checkout code
27+ uses : actions/checkout@v5
28+ with :
29+ fetch-depth : 0
30+ ref : ${{ github.event.workflow_run.head_branch }}
31+ repository : ${{ github.event.workflow_run.head_repository.full_name }}
32+
33+ - name : Setup Rust
34+ uses : dtolnay/rust-toolchain@stable
35+ with :
36+ components : rustfmt
37+
38+ - name : Run cargo fmt
39+ run : |
40+ echo "Running cargo fmt --all"
41+ cargo fmt --all
42+
43+ - name : Commit and push if changes
44+ id : commit
45+ run : |
46+ git config user.name "github-actions[bot]"
47+ git config user.email "github-actions[bot]@users.noreply.github.com"
48+ if [ -n "$(git status --porcelain)" ]; then
49+ git add -u
50+ git commit -m "Auto-format code [skip ci]"
51+ git push
52+ echo "formatted=true" >> $GITHUB_OUTPUT
53+ else
54+ echo "formatted=false" >> $GITHUB_OUTPUT
55+ fi
56+
57+ - name : Comment on PR if formatting was applied
58+ if : steps.commit.outputs.formatted == 'true' && github.event.workflow_run.event == 'pull_request'
59+ uses : marocchino/sticky-pull-request-comment@v2
60+ with :
61+ message : |
62+ Code has been automatically formatted.
63+ No action needed.
64+ the changes were committed with `[skip ci]`.
Original file line number Diff line number Diff line change @@ -307,15 +307,13 @@ jobs:
307307 run : python -I whats_left.py
308308
309309 lint :
310- name : Check Rust code with rustfmt and clippy
310+ name : Check Rust code with clippy
311311 runs-on : ubuntu-latest
312312 steps :
313313 - uses : actions/checkout@v5
314314 - uses : dtolnay/rust-toolchain@stable
315315 with :
316- components : rustfmt, clippy
317- - name : run rustfmt
318- run : cargo fmt --check
316+ components : clippy
319317 - name : run clippy on wasm
320318 run : cargo clippy --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings
321319 - uses : actions/setup-python@v6
You can’t perform that action at this time.
0 commit comments