From e0dd5006fe9f10118aa1979d0c0f8795b6b25e76 Mon Sep 17 00:00:00 2001 From: Arsh Date: Wed, 25 Feb 2026 13:25:54 +0530 Subject: [PATCH] CI: enforce newline at EOF and fix existing violations --- .github/workflows/lint.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8de3f55a9..8c9f14750 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -55,6 +55,7 @@ jobs: timeout-minutes: 10 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4 + - name: Check for whitespace issues in the repository # The two example.txt files need to be excluded because whitespace at EOL is part # of their format and they fail to parse otherwise. @@ -69,6 +70,19 @@ jobs: echo "$issues" [ "$issues" == "" ] || exit 1 + - name: Check for missing newline at EOF + run: | + missing_newline="$( + git ls-files | while read f; do + [ -f "$f" ] || continue + if [ -s "$f" ]; then + tail -c1 "$f" | read -r _ || echo "$f" + fi + done + )" + echo "$missing_newline" + [ "$missing_newline" == "" ] || exit 1 + ensure-sha-pinned-actions: runs-on: ubuntu-latest steps: