|
6 | 6 | format: |
7 | 7 | runs-on: ubuntu-latest |
8 | 8 | permissions: |
9 | | - contents: read |
| 9 | + contents: write |
10 | 10 |
|
11 | 11 | steps: |
12 | 12 | - name: Checkout code |
13 | 13 | uses: actions/checkout@v6 |
| 14 | + with: |
| 15 | + ref: ${{ github.head_ref || github.ref_name }} |
14 | 16 |
|
15 | 17 | - name: Setup LLVM 22 |
16 | 18 | uses: ZhongRuoyu/setup-llvm@v0 |
|
29 | 31 | toolchain: nightly |
30 | 32 | components: clippy, rustc-dev |
31 | 33 |
|
| 34 | + - name: Apply C++ formatting fixes |
| 35 | + run: find cpp2rust tests -name '*.cpp' -o -name '*.h' -o -name '*.c' | xargs clang-format -i |
| 36 | + |
| 37 | + - name: Apply Rust lint fixes |
| 38 | + run: | |
| 39 | + cargo clippy --fix --allow-dirty --manifest-path rules/Cargo.toml --all-targets |
| 40 | + cargo +nightly clippy --fix --allow-dirty --manifest-path rule-preprocessor/Cargo.toml --all-targets |
| 41 | + cargo clippy --fix --allow-dirty --manifest-path libcc2rs/Cargo.toml --all-targets |
| 42 | +
|
| 43 | + - name: Apply Rust formatting fixes |
| 44 | + run: | |
| 45 | + cargo fmt --manifest-path rules/Cargo.toml |
| 46 | + cargo fmt --manifest-path rule-preprocessor/Cargo.toml |
| 47 | + cargo fmt --manifest-path libcc2rs/Cargo.toml |
| 48 | + find tests -name '*.rs' -print0 | xargs -0 rustfmt |
| 49 | +
|
| 50 | + - name: Commit auto-fixes |
| 51 | + uses: stefanzweifel/git-auto-commit-action@v5 |
| 52 | + with: |
| 53 | + commit_message: "style: apply automatic formatting and lint fixes" |
| 54 | + |
32 | 55 | - name: Check C++ formatting |
33 | 56 | run: find cpp2rust tests -name '*.cpp' -o -name '*.h' -o -name '*.c' | xargs clang-format --dry-run --Werror |
34 | 57 |
|
|
37 | 60 | cargo fmt --manifest-path rules/Cargo.toml -- --check |
38 | 61 | cargo fmt --manifest-path rule-preprocessor/Cargo.toml -- --check |
39 | 62 | cargo fmt --manifest-path libcc2rs/Cargo.toml -- --check |
| 63 | + find tests -name '*.rs' -print0 | xargs -0 rustfmt --check |
40 | 64 |
|
41 | 65 | - name: Check Rust lints |
42 | 66 | run: | |
|
0 commit comments