Skip to content

chore: enforce Apache license headers with google/addlicense - #2928

Merged
cabljac merged 5 commits into
nextfrom
chore/addlicense
Jul 30, 2026
Merged

chore: enforce Apache license headers with google/addlicense#2928
cabljac merged 5 commits into
nextfrom
chore/addlicense

Conversation

@cabljac

@cabljac cabljac commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds google/addlicense enforcement for Apache 2.0 license headers on tracked .ts/.js files.

  • Commit 1 backfills headers into 160 files that were missing them (mostly tests and jest configs, some src). Insertions only, no code changes. Files with existing headers are untouched and keep their original copyright years.
  • Commit 2 adds the tooling and CI:
    • license-header.tmpl: header template matching the repo's existing header wording (https URL variant)
    • scripts/addlicense.sh: shared check/fix entrypoint using git ls-files (excludes node_modules, lib, dist, coverage and untracked files)
    • npm run license:check / npm run license:fix root scripts
    • New license job in the Validate workflow, pinned to addlicense v1.2.0, runs on every PR (~30s, no npm install needed)

Testing

  • ./scripts/addlicense.sh check exits 0 after backfill
  • Negative test: stripping a header makes check exit 1
  • npm run lint (prettier) clean on all changed files
  • firestore-send-email/functions tsc build passes with headers in place

https://claude.ai/code/session_013dz9GhC3metut6HFswPavu

cabljac added 2 commits July 30, 2026 08:27
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
@cabljac
cabljac requested a review from a team as a code owner July 30, 2026 07:28
Comment thread .github/workflows/validate.yml Fixed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread scripts/addlicense.sh Outdated
Required by zizmor unpinned-uses mandatory policy.

Claude-Session: https://claude.ai/code/session_013dz9GhC3metut6HFswPavu
Comment thread .github/workflows/validate.yml Fixed
cabljac added 2 commits July 30, 2026 08:33
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
@cabljac
cabljac merged commit 7b624a6 into next Jul 30, 2026
18 checks passed
@cabljac
cabljac deleted the chore/addlicense branch July 30, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants