File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 RUST_BACKTRACE : 1
1212
1313jobs :
14+ format :
15+ name : Auto-format Code
16+ runs-on : ubuntu-latest
17+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
18+
19+ steps :
20+ - name : Checkout code
21+ uses : actions/checkout@v4
22+ with :
23+ token : ${{ secrets.GITHUB_TOKEN }}
24+
25+ - name : Setup Rust
26+ uses : dtolnay/rust-toolchain@stable
27+ with :
28+ components : rustfmt
29+
30+ - name : Run cargo fmt
31+ run : cargo fmt --all
32+
33+ - name : Check for changes
34+ id : git-check
35+ run : |
36+ git diff --exit-code || echo "has_changes=true" >> $GITHUB_OUTPUT
37+
38+ - name : Commit and push if changed
39+ if : steps.git-check.outputs.has_changes == 'true'
40+ run : |
41+ git config user.name "github-actions[bot]"
42+ git config user.email "github-actions[bot]@users.noreply.github.com"
43+ git add -A
44+ git commit -m "style: auto-format code with rustfmt [skip ci]"
45+ git push
46+
1447 test :
1548 name : Test
1649 runs-on : ubuntu-latest
50+ needs : format
51+ if : always()
1752
1853 services :
1954 postgres :
68103 run : |
69104 psql -h localhost -U postgres -d e2ee -f sql_models/seed.sql
70105
71- - name : Check formatting
72- run : cargo fmt --all -- --check
73-
74106 - name : Clippy
75107 run : cargo clippy --all-targets --all-features -- -D warnings
76108
You can’t perform that action at this time.
0 commit comments