chore: enforce Apache license headers with google/addlicense - #2928
Merged
Conversation
Adds a license job to the Validate workflow that runs google/addlicense in check mode over tracked ts/js files. Run npm run license:fix locally to add missing headers. Claude-Session: https://claude.ai/code/session_013dz9GhC3metut6HFswPavu
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds Apache license headers to numerous source and test files across the repository, introduces a license template, and adds npm scripts to check and fix license headers. It also introduces a helper shell script, scripts/addlicense.sh, to automate this process. Feedback on the pull request suggests making the shell script more robust by validating the input mode, handling filenames with spaces using null-terminated strings, and avoiding potential pipeline failures from grep when pipefail is enabled.
Required by zizmor unpinned-uses mandatory policy. Claude-Session: https://claude.ai/code/session_013dz9GhC3metut6HFswPavu
Resolves zizmor excessive-permissions finding. Claude-Session: https://claude.ai/code/session_013dz9GhC3metut6HFswPavu
NUL-separated file list for filenames with special characters, and reject unknown modes instead of defaulting to fix. Claude-Session: https://claude.ai/code/session_013dz9GhC3metut6HFswPavu
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.
Summary
Adds google/addlicense enforcement for Apache 2.0 license headers on tracked
.ts/.jsfiles.license-header.tmpl: header template matching the repo's existing header wording (https URL variant)scripts/addlicense.sh: shared check/fix entrypoint usinggit ls-files(excludes node_modules, lib, dist, coverage and untracked files)npm run license:check/npm run license:fixroot scriptslicensejob in the Validate workflow, pinned to addlicense v1.2.0, runs on every PR (~30s, no npm install needed)Testing
./scripts/addlicense.sh checkexits 0 after backfillnpm run lint(prettier) clean on all changed filesfirestore-send-email/functionstsc build passes with headers in placehttps://claude.ai/code/session_013dz9GhC3metut6HFswPavu