name: Format

on: [ push, pull_request ]

permissions:
  contents: read  # to fetch code (actions/checkout)

env:
  CCACHE_DIR: "${{ github.workspace }}/.ccache"

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  format:
    name: Check formatting
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        environment: [lint]
    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
      - uses: prefix-dev/setup-pixi@92815284c57faa15cd896c4d5cfb2d59f32dc43d # v0.8.3
        with:
          pixi-version: v0.48.2
          cache: true
          environments: ${{ matrix.environment }}
      - name: Check for formatting violations
        run: |
          pixi run format-dry-error
          echo "Please execute 'pixi run format' to fix any errors."
