-
Notifications
You must be signed in to change notification settings - Fork 86
38 lines (35 loc) · 964 Bytes
/
rustfmt.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: rustfmt
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
# https://github.com/reviewdog/action-suggester?tab=readme-ov-file#required-permissions
permissions:
contents: read
checks: write
issues: write
pull-requests: write
jobs:
rustfmt:
name: Rustfmt Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Rustfmt check
if: ${{ github.event_name != 'pull_request' }}
run: cargo fmt -- --check -v
- name: Rustfmt PR
if: ${{ github.event_name == 'pull_request' }}
run: cargo fmt -- -v
- name: Suggest format changes
if: ${{ github.event_name == 'pull_request' }}
uses: reviewdog/action-suggester@v1
with:
tool_name: rustfmt
fail_on_error: true