Skip to main content

Crate lintel_github_action

Crate lintel_github_action 

Source
Expand description

§lintel-github-action

Crates.io docs.rs GitHub License

Validate JSON, YAML, and TOML files against JSON Schema in your pull requests. Creates a GitHub Check Run named Lintel with inline annotations using the Checks API.

Available as lintel github-action in the main lintel binary and used by the lintel-rs/action GitHub Action.

§Quick start

name: Lint
on: [pull_request]

permissions:
  checks: write
  contents: read

jobs:
  lintel:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: lintel-rs/action@v0

With zero configuration Lintel auto-discovers files and matches them against schemas from the SchemaStore catalog.

§Action inputs

InputDescriptionDefault
versionlintel-github-action version to installlatest
github-tokenGitHub token for creating Check Runs${{ github.token }}
pathsSpace-separated paths or globs to validate(auto-discover)
excludeComma-separated exclude patterns
argsAdditional arguments passed to the binary

§Examples

§Validate specific paths

- uses: lintel-rs/action@v0
  with:
    paths: "config/**/*.yaml src/*.json"

§Exclude directories

- uses: lintel-rs/action@v0
  with:
    exclude: "vendor/**, node_modules/**"

§Pin a specific version

- uses: lintel-rs/action@v0
  with:
    version: v0.0.9

§Configuration

Place a lintel.toml in your repository root to configure schema mappings, exclude patterns, and more. See the Lintel documentation for details.

§How it works

  1. Downloads the lintel binary from the lintel releases
  2. Runs lintel github-action (validation + format checks) on your repository files
  3. Creates a GitHub Check Run with inline annotations on files with schema violations or format issues (batched at 50 per API call)
  4. Reports pass/fail with a summary table

§Permissions

The action needs checks: write to create Check Runs and contents: read to access repository files.

permissions:
  checks: write
  contents: read

§Environment variables

When running the binary directly (outside the GitHub Action wrapper), these environment variables are required:

VariableDescription
GITHUB_TOKENGitHub token with checks:write permission
GITHUB_REPOSITORYRepository in owner/repo format
GITHUB_SHACommit SHA to annotate
GITHUB_API_URLGitHub API base URL (defaults to https://api.github.com)

All of these are set automatically when running inside GitHub Actions.

§License

Apache-2.0

Structs§

GithubActionArgs

Functions§

github_action_args
Construct the bpaf parser for GithubActionArgs.
run
Run lintel checks and post results as a GitHub Check Run.