build(license): stamp ASF header into .gitignore files + enforce in prek#846
Merged
Merged
Conversation
The 9 tracked .gitignore files carried no licence header. RAT ignores .gitignore by default, so CI stayed green while they shipped unlicensed — a gap for a source-first ASF project where the archive is the release. Extend the add-license-headers hook (previously Markdown-only) to also stamp .gitignore with the full ASF header — the same `#`-comment block .gitattributes and .pre-commit-config.yaml carry, per the convention that hash-comment config files get the full header while Markdown gets the SPDX identifier. A leading comment block is inert to git's ignore parser. - tools/dev/add-license-headers.py: add ASF_HEADER_HASH; stamp .gitignore with it; recognise the ASF header line for idempotency; --all now covers tracked .gitignore too. - .pre-commit-config.yaml: hook `files:` now matches .gitignore; name and comment updated. - Stamp all 9 existing .gitignore files. Idempotent (re-run is a no-op) and RAT-approved. Note: .py files are already fully licensed (208 full ASF header, 2 SPDX) and enforced by RAT; this change closes the .gitignore gap specifically.
This was referenced Jul 12, 2026
potiuk
added a commit
that referenced
this pull request
Jul 13, 2026
…der (#846/#847 reversal) (#849) Reverse the approach from #846/#847. Rather than stamping the full ASF header into every tracked .gitignore and forcing RAT to scan them, treat .gitignore as hash-comment config with no downstream licensing significance and exclude it from the RAT check. - Strip the ASF header from all 9 tracked .gitignore files. - .rat-excludes: add an explicit **/.gitignore + .gitignore exclusion (parsed-scm GIT self-excludes them too; the entry makes it explicit). - .github/workflows/rat.yml: drop `--input-include '**/.gitignore'`; the ignore files are no longer force-included, so the default exclusion holds. - tools/dev/add-license-headers.py: revert to Markdown-only (drop ASF_HEADER_HASH, the .gitignore stamping branch, and .gitignore from --all's tracked targets). - .pre-commit-config.yaml: hook `files:` back to `\.md$`, name/comment back to Markdown-only. Co-authored-by: Tester <t@example.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The 9 tracked
.gitignorefiles carried no licence header. Apache RATignores
.gitignoreby default, so CI stayed green while they shippedunlicensed — a gap for a source-first ASF project where the
git archivesource zip is the release.
What
Extend the existing
add-license-headershook (previously Markdown-only) toalso stamp
.gitignore, with the full ASF header as#comments — thesame block
.gitattributesand.pre-commit-config.yamlcarry. This followsthe project convention (documented in
.rat-excludes): hash-comment configfiles carry the full header; Markdown carries the SPDX identifier. A leading
comment block is inert to git's ignore parser.
tools/dev/add-license-headers.py— addASF_HEADER_HASH; stamp.gitignorewith it; recognise the ASF header's first line foridempotency;
--allnow covers tracked.gitignoretoo..pre-commit-config.yaml— hookfiles:regex now matches.gitignore; hook name + comment updated..gitignorefiles.Idempotent (re-running is a no-op) and RAT-approved.
Note on
.py.pyfiles are already fully licensed (208 with the full ASF header, 2 withthe SPDX short form; zero unlicensed) and enforced by RAT in CI — they're just
stamped manually rather than by a hook. This PR closes the
.gitignoregapspecifically; if you'd want
.pyauto-stamping too (with shebang handling),that's a separate follow-up.