From 54cb33504e403ee4dcc14abddba243d70ee5ea86 Mon Sep 17 00:00:00 2001 From: Tester Date: Sun, 12 Jul 2026 23:39:39 +0200 Subject: [PATCH] ci(rat): enforce the ASF header on .gitignore files RAT's parsed-scm GIT exclusion self-excludes the tracked .gitignore files, so the headers stamped by add-license-headers were not actually enforced in CI. Add `--input-include '**/.gitignore'` to override that exclusion so RAT scans (and requires an approved header on) every tracked .gitignore. Verified locally with apache-rat 0.18: +8 .gitignore files move into scope, all Approved (0 unapproved); a headerless .gitignore is reported Unapproved and fails the check. `.git/` stays excluded as a hidden dir, and .apache-magpie-overrides/.gitignore stays excluded under its hidden dir. --- .github/workflows/rat.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/rat.yml b/.github/workflows/rat.yml index ae87cdf8..6b987ff1 100644 --- a/.github/workflows/rat.yml +++ b/.github/workflows/rat.yml @@ -75,6 +75,12 @@ jobs: # off the report so contributors get the offending file list, not a # Java stack trace. --input-exclude-parsed-scm GIT honours # .gitignore; --input-exclude-std GIT/HIDDEN_DIR skips VCS metadata. + # --input-include '**/.gitignore' overrides those exclusions for the + # tracked .gitignore files themselves (parsed-scm GIT otherwise + # self-excludes the ignore files), so RAT enforces the ASF header + # that tools/dev/add-license-headers.py stamps into them. (.git/ is + # still skipped as a hidden dir; .apache-magpie-overrides/.gitignore + # stays excluded under its hidden dir.) jar="${RUNNER_TEMP}/apache-rat-${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar" report="${RUNNER_TEMP}/rat-report.txt" stderr_log="${RUNNER_TEMP}/rat-stderr.log" @@ -82,6 +88,7 @@ jobs: --input-exclude-std GIT HIDDEN_DIR \ --input-exclude-parsed-scm GIT \ --input-exclude-file .rat-excludes \ + --input-include '**/.gitignore' \ --output-style unapproved-licenses \ --output-file "${report}" \ . 2>"${stderr_log}" && rc=0 || rc=$?