ci: align pre-commit hooks and GitHub templates - #517
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
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
|
@yinggeh — all your questions across the PR set are answered now; summary of where:
This PR (core) carries no repo-specific deviations — shared baseline only. Could you re-review when you get a chance? |
Grant issues:write to the labeling job (review feedback). TRI-1100
Greptile SummaryThis PR aligns the repo's CI toolchain with the org-wide baseline: a new
Confidence Score: 5/5Safe to merge — changes are limited to CI workflow configs and a pre-commit config; no source code is touched. All three files are CI/tooling-only changes with no effect on the compiled library. The dual-event guard in conventional-pr.yml is correctly structured. The pre-commit workflow's null-delimited xargs pipeline correctly handles deleted files and spaces in paths. The .pre-commit-config.yaml changes are additive and non-breaking for existing contributors. The previously flagged fork-token issue is fully addressed by the pull_request_target routing. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant GH as GitHub PR Event
participant ConvPR as conventional-pr.yml
participant OrgWF as org .github reusable workflow (v1.4.3)
participant PreCommit as pre-commit.yml
participant Cache as actions/cache
Dev->>GH: Open / Edit / Sync PR
GH->>ConvPR: pull_request (same-repo) OR pull_request_target (fork)
Note over ConvPR: if-guard routes event type<br/>same-repo → pull_request<br/>fork → pull_request_target
ConvPR->>OrgWF: "uses: conventional-pr.yml@v1.4.3<br/>permissions: pull-requests:write, issues:write"
OrgWF-->>GH: Validate PR title, apply type labels, detect cherry-picks
GH->>PreCommit: pull_request (all PRs)
PreCommit->>Cache: "Restore ~/.cache/pre-commit<br/>key: OS + hash(.pre-commit-config.yaml)"
PreCommit->>PreCommit: "git diff -z --diff-filter=d HEAD^1 HEAD"
PreCommit->>PreCommit: xargs -0 --no-run-if-empty pre-commit run --files
PreCommit-->>GH: Pass/Fail on modified files only
Note over Dev: Local commit
Dev->>Dev: pre-commit stage: isort, black, flake8, clang-format, codespell, add-license
Dev->>Dev: commit-msg stage: conventional-pre-commit validates message format
Reviews (2): Last reviewed commit: "ci: harden CI workflows and configs per ..." | Re-trigger Greptile |
| permissions: | ||
| pull-requests: write | ||
| issues: write | ||
| uses: triton-inference-server/.github/.github/workflows/conventional-pr.yml@v1.4.2 |
There was a problem hiding this comment.
PR description version mismatch
The PR description and its body text reference v1.4.1 throughout ("pinned tags current: v1.4.1"), but the actual pin here — and in .pre-commit-config.yaml line 87 — is v1.4.2. This is a documentation inconsistency; if v1.4.2 is the intended version (and CI is green), the description should be updated to avoid confusion when tracking which org-wide tag is live in this repo.
There was a problem hiding this comment.
Fixed - documentation drift: the descriptions have been refreshed to the current pinned tag v1.4.3 (they lagged behind the tag revisions; the tag exists and CI is green fleet-wide).
- 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
Restrict to title-only makes more sense since not every commit has a type (most commits are trivial) and all commits likely share the same type. |
|
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)