ChkTeX is a LaTeX linter. A linter is a program that checks your work for potential stylistic or formatting issues. For LaTeX, this includes soft errors (e.g., missing braces or alignment problems) and choices that could lead to rendering inconsistencies.
This Action runs ChkTeX version 1.7.9 on .tex files in your repository.
To customize ChkTeX's behavior, add a .chktexrc configuration file to your repository's root.
This file allows you to define specific rules and exclusions for the linter.
Refer to the ChkTeX documentation for details on how to create and configure this file.
If no local repository .chktexrc file can be found, the action will use the global ChkTeX configuration distributed as
part of the ChkTeX software that runs in the Action container.
ChkTeX Action reviews your pull requests when used with the pull_request event.
If ChkTeX reports errors or warnings, the Action will request changes:
When this happens, the files changed will be annotated with the error and warning messages from ChkTeX:
Once you fix all the issues and trigger the Action again, the Action will approve your pull request:
ChkTeX Action also posts a step summary under Actions > [workflow run] > Summary:
To use this Action in your repository, add it to your custom workflow.
By default, the Action will only lint the files in the latest pushed commit when used with the push event.
If you want to override this behavior, set lint-all: true to lint all .tex files in your repository.
When used with the pull_request event, the Action only lints the .tex files that are part of the pull request.
push: Lints.texfiles in the latest pushed commit.pull_request: Lints.texfiles that are part of the pull request.
- For the
pushevent, set:contents: read
- For the
pull_requestevent, set:pull-requests: writechecks: write- Additionally, enable
Allow GitHub Actions to create and approve pull requestsunderRepository > Settings > Actions > General > Workflow permissions
lint-all: Force lint of all files in the repository.- Default:
false
- Default:
name: Lint
on: push # Or `pull_request`
permissions:
contents: read
pull-requests: write # When using the `pull_request` event
checks: write # When using the `pull_request` event
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run ChkTeX
uses: j2kun/chktex-action@v2
with:
lint-all: true # Default: `false`