name: "format"
on:
  pull_request:
  push:
    branches: [ "main" ]

jobs:
  format:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v5
      - name: Install Nix
        uses: cachix/install-nix-action@v31
        with:
          github_access_token: ${{ secrets.GITHUB_TOKEN }}
      - name: Setup Caching
        uses: cachix/cachix-action@v16
        with:
          name: selfhostblocks
          authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
      - name: Check Formatting
        run: |
          find . -name '*.nix' | nix fmt -- --ci
