name: Rustfmt check

on:
  push:
    branches:
      - 'main'
    paths:
      - '.github/workflows/rustfmt.yml'
      - 'userspace/ksud/**'
  pull_request:
    branches:
      - 'main'
    paths:
      - '.github/workflows/rustfmt.yml'
      - 'userspace/ksud/**'

permissions:
  checks: write

jobs:
  format:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt

      - uses: LoliGothick/rustfmt-check@master
        with:
          token: ${{ github.token }}
          working-directory: userspace/ksud
