Integrations

Pre-Commit

pre-commit is a framework for managing and maintaining multi-language pre-commit hooks. It runs checks on your code before each commit to ensure quality and consistency.

Create a .pre-commit-config.yaml file in your repository root:

repos:
  - repo: https://github.com/jolars/panache
    rev: vunknown
    hooks:
      - id: panache-format
      - id: panache-lint

Then install the hooks:

pre-commit install

panache provides two hook IDs:

panache-format
Automatically formats files according to panache’s formatting rules
panache-lint
Lints files and automatically applies fixes where possible

Pass additional arguments to panache:

repos:
  - repo: https://github.com/jolars/panache
    rev: vunknown
    hooks:
      - id: panache-format
        args: [--config, custom-config.toml]

File Patterns

By default, hooks run on .qmd, .md, .markdown, and .Rmd files. Override with files:

repos:
  - repo: https://github.com/jolars/panache
    rev: vunknown
    hooks:
      - id: panache-format
         files: '\.(qmd|Rmd)$' # Only .qmd and .Rmd

GitHub Actions

Use the dedicated panache action for a one-line setup:

name: panache
on:
  pull_request:
  push:
    branches: [main]

jobs:
  format-and-lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: jolars/panache-action@v1

This workflow:

  1. Installs panache from official releases
  2. Checks that all files are formatted (--check mode)
  3. Runs the linter in CI mode (--check mode)

Both steps will fail (exit code 1) if issues are found, preventing the PR from merging.

Common options

Pin a specific panache CLI release:

- uses: jolars/panache-action@v1
  with:
    panache-version: v2.23.0

Run only one check:

- uses: jolars/panache-action@v1
  with:
    lint: "false" # format only
- uses: jolars/panache-action@v1
  with:
    format: "false" # lint only

Manual setup (advanced)

If you prefer installing via Rust directly, you can keep using a manual workflow:

name: panache
on:
  pull_request:
  push:
    branches: [main]

jobs:
  format-and-lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
      - name: Cache cargo
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
          key: ${{ runner.os }}-cargo-panache-${{ hashFiles('**/Cargo.lock') }}
      - name: Install panache
        run: cargo install panache --locked
      - name: Check formatting
        run: panache format --check .
      - name: Run linter
        run: panache lint --check .