From 05796d016562219c14355254d44abd0a3721bec3 Mon Sep 17 00:00:00 2001 From: "Rifqi D. Panuluh" <69516665+nuluh@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:42:29 +0700 Subject: [PATCH] Create latex-lint.yml --- .github/workflows/latex-lint.yml | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/latex-lint.yml diff --git a/.github/workflows/latex-lint.yml b/.github/workflows/latex-lint.yml new file mode 100644 index 0000000..7dfcb18 --- /dev/null +++ b/.github/workflows/latex-lint.yml @@ -0,0 +1,48 @@ +name: LaTeX Lint + +on: + push: + branches: + - main + - dev + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install chktex and dependencies + run: | + sudo apt-get update + sudo apt-get install -y chktex + + - name: Find all .tex files and run chktex + run: | + # Exit with non-zero if any .tex file ha​s a lint error + files=$(find latex -type f -name "*.tex") + if [ -z "$files" ]; then + echo "No .tex files found under latex/—skipping lint." + exit 0 + fi + + echo "Running chktex on:" + 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 + for f in $files; do + chktex -q -n1 "$f" || FAIL=1 + done + + if [ $FAIL -ne 0 ]; then + echo "::error::Lint errors detected in one or more .tex files." + exit 1 + fi + + - name: Success message + if: ${{ always() && success() }} + run: echo "✅ All .tex files passed chktex lint."