Update latex-lint.yml
This commit is contained in:
31
.github/workflows/latex-lint.yml
vendored
31
.github/workflows/latex-lint.yml
vendored
@@ -5,44 +5,39 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- dev
|
- dev
|
||||||
|
paths:
|
||||||
|
- 'latex/**/*.tex'
|
||||||
|
- 'latex/main.tex'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install chktex and dependencies
|
- name: Install chktex
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y chktex
|
sudo apt-get install -y chktex
|
||||||
|
|
||||||
- name: Find all .tex files and run chktex
|
- name: Run chktex inside latex/
|
||||||
|
working-directory: latex
|
||||||
run: |
|
run: |
|
||||||
# Exit with non-zero if any .tex file has a lint error
|
TEX_FILES=$(find . -type f -name "*.tex")
|
||||||
files=$(find latex -type f -name "*.tex")
|
if [ -z "$TEX_FILES" ]; then
|
||||||
if [ -z "$files" ]; then
|
echo "No .tex files found in latex/. Skipping lint."
|
||||||
echo "No .tex files found under latex/—skipping lint."
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running chktex on:"
|
echo "Linting .tex files with chktex..."
|
||||||
echo "$files" | tr ' ' '\n'
|
|
||||||
|
|
||||||
# Run chktex on each file; fail if any issues reported
|
|
||||||
# -q suppresses info messages; -n1 treats warnings/errors as fatal
|
|
||||||
FAIL=0
|
FAIL=0
|
||||||
for f in $files; do
|
for f in $TEX_FILES; do
|
||||||
chktex -q -n1 "$f" || FAIL=1
|
chktex -q -n1 "$f" || FAIL=1
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $FAIL -ne 0 ]; then
|
if [ $FAIL -ne 0 ]; then
|
||||||
echo "::error::Lint errors detected in one or more .tex files."
|
echo "::error::Lint errors detected."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Success message
|
|
||||||
if: ${{ always() && success() }}
|
|
||||||
run: echo "✅ All .tex files passed chktex lint."
|
|
||||||
|
|||||||
Reference in New Issue
Block a user