ci: align pre-commit hooks and GitHub templates - #16
Conversation
Adopt the shared pre-commit baseline: two-line SPDX header, conventional commit message validation (commit-msg stage), and the centralized add-license / add-spdx-license hooks from developer_tools v0.2.0. Run pre-commit CI only on files modified by the PR, and roll out the standard issue templates and the simplified single PR template. TRI-1100
Legal's Copyright / License Header Guidance specifies the SPDX form without a comma after the year. TRI-1100
Human-readable type labels with enforced descriptions and colors. TRI-1100
Deliberate maintenance bump to include the year of the current modifications; required by the add-license hook's new staleness check (hooks themselves never modify LICENSE files). 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
Grant issues:write to the labeling job (review feedback). TRI-1100
Greptile SummaryThis PR aligns the repository with the org-wide CI/CD baseline in
Confidence Score: 5/5Safe to merge — all changes are CI/tooling configuration with no production code impact. The changes are well-structured: the pull_request_target security concern is explicitly mitigated by the if guard and by the reusable workflow not checking out PR code; the null-delimited xargs pipeline correctly handles spaces and empty diffs; both org-hook refs are mutually consistent at v1.4.3. The only observation is a minor pinning inconsistency on actions/cache. No files require special attention; .github/workflows/pre-commit.yml has a minor action-pinning inconsistency noted in comments. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
PR([Pull Request opened / updated]) --> EVENT{Event source}
EVENT -->|same-repo PR| PC_EVENT[pull_request event]
EVENT -->|fork PR| PT_EVENT[pull_request_target event]
PC_EVENT --> IF_GUARD{if: head.repo == repository}
PT_EVENT --> IF_GUARD2{if: head.repo != repository}
IF_GUARD -->|true| CONV_JOB[conventional-pr job\npermissions: PR write + issues write]
IF_GUARD2 -->|true| CONV_JOB
CONV_JOB --> REUSABLE[triton-inference-server/.github\nconventional-pr.yml @ v1.4.3]
REUSABLE --> LINT[Validate PR title\nConventional Commits]
REUSABLE --> LABEL[Derive + apply type label\nci / feat / fix / ...]
REUSABLE --> CHERRY[Detect cherry-picks]
PR --> PRECOMMIT_JOB[pre-commit job\npermissions: contents read]
PRECOMMIT_JOB --> CHECKOUT[actions/checkout @ v5.0.0\nfetch-depth: 2]
CHECKOUT --> CACHE[actions/cache @ v4\n~/.cache/pre-commit]
CACHE --> DIFF[git diff -z --diff-filter=d HEAD^1 HEAD]
DIFF --> XARGS[xargs -0 --no-run-if-empty\npre-commit run --files]
XARGS --> HOOKS[isort · black · flake8\nclang-format · codespell\nconventional-pre-commit\nadd-license @ v1.4.3]
LOCAL([Developer local commit]) --> COMMIT_MSG[commit-msg hook\nconventional-pre-commit v4.4.0]
LOCAL --> PRECOMMIT_LOCAL[pre-commit hooks\nall existing hooks]
Reviews (2): Last reviewed commit: "ci: harden CI workflows and configs per ..." | 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
|
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 with the org-wide setup consolidated in triton-inference-server/.github:
.pre-commit-config.yaml: shared baseline hooks, conventional-commit message validation (commit-msg stage), and the centralizedadd-licensehook from the org.githubrepository (rev: v1.4.3— excludes.github/templates, never rewrites LICENSE files).conventional-prworkflow (@v1.4.3): validates the PR title against Conventional Commits (hard gate — it becomes the squash-merge commit), derives one human-readable label per distinct type found in the title and all conforming commit subjects (e.g.ci:→CI/CD,feat:→feature,fix:→fix), enforces org-wide label colors/descriptions, detects cherry-picks, and fails if no type is derivable and no type label is assigned.Depends on triton-inference-server/.github#5 (pinned tags current:
v1.4.3— already exist, CI is green).Pros / Cons
Pros
.githubrepo) for hooks, templates, issue routing, and the PR-title workflow — one change propagates everywhere.Cons / risks
.githubrepository (tags are write-once; changes ship as a new tag + rev bump)..githubrepository to remain public.Related Issues / PRs
Related PRs:
Test plan
pre-commit validate-configpasses;pre-commit run --files <PR diff>passes locally with the centralized hooks pinned to the .github branch SHA.v1.4.3exists: the conventional-pr check validates this PR's own title and applies thecilabel.Caveats
Checklist
<commit_type>: <Title>(conventional commit)