---
name: Rust formatting
on:
  pull_request:
    paths:
      - .github/workflows/*.yml
      - '**/*.rs'
  workflow_dispatch:
jobs:
  check-formatting:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions-rs/toolchain@v1.0.6
        with:
          toolchain: stable
          components: rustfmt
          override: true

      - name: Check formatting
        run: |
          rustfmt --version
          cargo fmt -- --check
