on: push
name: cargo fmt

permissions:
  actions: read # An explanation.

jobs:
  cargo_fmt:
    name: cargo fmt
    runs-on: ubuntu-latest

    concurrency:
      group: ${{ github.workflow }}-${{ github.ref }}

    permissions:
      security-events: write # An explanation.
      actions: read # An explanation.

    steps:
      - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
        with:
            persist-credentials: false

      - name: Run cargo fmt
        run: |
          rustup component add rustfmt
          cargo fmt --all --check