chore: never modify the COPYRIGHT template and guard .github templates#1032
chore: never modify the COPYRIGHT template and guard .github templates#1032mc-nv wants to merge 16 commits into
Conversation
Align the self-contained copyright hook with NVIDIA Legal header guidance: compute the header's copyright year in memory instead of rewriting tools/COPYRIGHT on every run, and exclude .github/ so GitHub issue/PR templates keep their YAML frontmatter first. TRI-1100
A full --all-files run bumps the copyright year of every file with a stale year, failing CI for any PR at year rollover. Check only the files the PR modifies, mirroring the other triton-inference-server repositories. TRI-1100
PR templates are inherited from triton-inference-server/.github instead of local copies; add the caller stub for the org-wide conventional-pr reusable workflow (PR title validation + type labeling). TRI-1100
Org-wide label color scheme and cherry-pick detection. TRI-1100
Human-readable type labels with enforced descriptions and colors. TRI-1100
The add-license hook now fails when the LICENSE copyright year is stale. TRI-1100
Workflow files are license-processed again (only templates excluded); refresh the stale copyright year this repo's pre-commit workflow carried. TRI-1100
…dd-copyright exclude The conventional-pr stub carried a BSD long-form header - the wrong license assertion in this Apache-2.0 repository - and codeql.yml / python-package.yaml had the same pre-existing issue. Convert all three to the repo's SPDX Apache two-line convention (start years preserved as ranges). Narrow the add-copyright exclude to template paths only so .github/workflows is under header enforcement. TRI-1100
Grant issues:write to the labeling job (review feedback). TRI-1100
Greptile SummaryThis PR refactors the copyright tooling and CI so that pre-commit hooks never produce surprise diffs on the
Confidence Score: 5/5Safe to merge — the changes are confined to CI tooling, copyright header plumbing, and license-text normalization; no application logic is affected. The core change — computing the copyright header in memory instead of rewriting the template file — is a clean, well-scoped refactor. The regex substitution in get_license() behaves identically to the old disallow_range=True path. The workflow changes (targeted pre-commit diff, caching, header normalization, new conventional-pr caller) are all standard patterns and the pull_request_target guard correctly prevents double-triggering and limits permissions to PR/issue writes. No files require special attention. The new conventional-pr.yml delegates to an external reusable workflow (@v1.4.3); reviewers may want to confirm that tag is immutable in the org .github repo, consistent with the comment in the file. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[PR opened / pushed] --> B{pull_request event}
B --> C[actions/checkout\nfetch-depth: 2]
C --> D[actions/cache\n~/.cache/pre-commit]
D --> E[pip install pre-commit]
E --> F[git diff --name-only -z\n--diff-filter=d HEAD^1 HEAD]
F --> G{Any modified\nnon-deleted files?}
G -- No files --> H[xargs --no-run-if-empty\nskips — exit 0]
G -- Files listed --> I[pre-commit run --files\non changed paths only]
I --> J[add-copyright hook]
J --> K{File in exclude\npattern?}
K -- Yes --> L[Skip — no header injection]
K -- No --> M[get_license in memory\ncurrent year only]
M --> N{File has\ncopyright already?}
N -- Yes --> O[update_copyright_year\nin file]
N -- No --> P[Insert header\nwith current year]
O --> Q[COPYRIGHT template\nunchanged]
P --> Q
Reviews (3): Last reviewed commit: "ci: keep this repo's Apache SPDX header ..." | Re-trigger Greptile |
- conventional-pr stub: dual pull_request/pull_request_target triggers so fork PRs from external contributors get labeled too (the reusable workflow never checks out PR code); explicit contents:read; pinned v1.4.3. - pre-commit workflow: robust modified-files runner (null-delimited paths, deletion-only PRs handled, deleted paths filtered, no undocumented -r flag, cache keyed on config hash). - flake8 args quoted correctly (the flow-scalar form split at commas and silently reduced the select list). - hooks pinned to .github v1.4.3. TRI-1100
The fleet stub refresh reintroduced the BSD long-form header; this repository's convention is the two-line SPDX Apache header and its add-copyright hook enforces it. TRI-1100
|
Closing: the team is moving away from centralized org-level configuration in favor of per-repository self-contained setups (see triton-inference-server/server#8897 for the first decentralized implementation). Branch retained for reference. TRI-1100 |
What does the PR do?
Aligns this repository's self-contained copyright hook with NVIDIA's copyright/license header guidance. model_analyzer keeps its own SPDX implementation (Apache-2.0) and does not adopt the centralized developer_tools hooks:
tools/add_copyright.pycomputes the header's copyright year in memory instead of rewriting thetools/COPYRIGHTtemplate file on every run — hooks never modify license/copyright source files.add-copyrighthook excludes.github/so GitHub issue/PR templates keep their YAML frontmatter first.--all-filesrun bumps every stale copyright year and fails any PR at year rollover.@v1.4.3) — title validation, multi-label from commit types, org-wide label colors, cherry-pick detection..github/workflows/is under header enforcement.Pros / Cons
Pros
tools/COPYRIGHTat year rollover; newly-inserted headers always carry the current year..github/templates are protected from header injection that would break their frontmatter.Cons / risks
Related Issues / PRs
Related PRs:
Test plan
pre-commit validate-configpasses.tools/COPYRIGHTstays byte-identical (verified via md5).Caveats