diff --git a/.github/workflows/format-tex.yaml b/.github/workflows/format-tex.yaml new file mode 100755 index 00000000..4bc36a83 --- /dev/null +++ b/.github/workflows/format-tex.yaml @@ -0,0 +1,18 @@ +name: format-tex + +on: [push, pull_request] + +jobs: + format-tex: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install Dependencies + run: | + sudo apt install chktex + + - name: Run chktex + run: | + chktex --nowarn={1,2,8,11,12,36,39} docs/*.tex diff --git a/scripts/pre-commit b/scripts/pre-commit index 0a722aae..881c8b3e 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -50,6 +50,14 @@ if git diff --staged --name-only | grep '\.py$'; then || exit 1 fi +# TeX +if git diff --staged --name-only | grep '\.tex$'; then + chktex --version \ + || { echo HINT: Please install chktex, e.g. '$ sudo apt install chktex'; exit 1; } + chktex --nowarn={1,2,8,11,12,36,39} $(git ls-files | grep '\.tex$') \ + || exit 1 +fi + # Other files for ext in yml yaml json md html mjs; do if git diff --staged --name-only | grep '\.'$ext'$'; then