Skip to content

chore: add local DCO check via pre-commit commit-msg hook#1131

Merged
psschwei merged 1 commit into
generative-computing:mainfrom
ajbozarth:chore/dco-precommit-hook
May 22, 2026
Merged

chore: add local DCO check via pre-commit commit-msg hook#1131
psschwei merged 1 commit into
generative-computing:mainfrom
ajbozarth:chore/dco-precommit-hook

Conversation

@ajbozarth
Copy link
Copy Markdown
Contributor

Issue

Fixes #

Description

Adds a commit-msg-stage pre-commit hook that fails commits missing a Signed-off-by trailer, complementing the GitHub DCO bot enabled in #1129. Surfaces the same DCO check locally so contributors find out at commit time instead of after pushing.

default_install_hook_types: [pre-commit, commit-msg] ensures pre-commit install wires up both hook types automatically — no special install flags needed.

Existing contributors: re-run pre-commit install once after pulling this branch to pick up the new commit-msg hook.

Long-time contributors: if your .git/hooks/ directory has leftover pre-commit.legacy or pre-commit.old files from previous migrations, pre-commit install will detect them, enter migration mode, and silently skip installing the new commit-msg hook. After running pre-commit install, check for .git/hooks/commit-msg — if it's missing, run the explicit form once:

pre-commit install --hook-type commit-msg

After that, future config changes are picked up automatically with no further action.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Manually verified on clean clones:

  • Fresh clone + pre-commit install installs both pre-commit and commit-msg hooks
  • Existing-contributor path (clone, install pre-commit on main, switch to this branch, re-run pre-commit install) also installs both hooks
  • git commit -m "..." (no -s) fails with Missing Signed-off-by trailer. Use: git commit -s
  • git commit -s -m "..." passes the DCO check

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

Adds a commit-msg-stage hook that fails commits missing a Signed-off-by
trailer, surfacing the same check the GitHub DCO bot enforces at PR time.
default_install_hook_types ensures `pre-commit install` wires up both
pre-commit and commit-msg hooks on fresh clones.

Assisted-by: Claude Code
Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
@ajbozarth ajbozarth requested a review from a team as a code owner May 21, 2026 22:31
@ajbozarth ajbozarth self-assigned this May 21, 2026
@ajbozarth ajbozarth enabled auto-merge May 21, 2026 22:35
@ajbozarth ajbozarth added this pull request to the merge queue May 21, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 21, 2026
@ajbozarth ajbozarth added this pull request to the merge queue May 21, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks May 22, 2026
@psschwei psschwei added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks May 22, 2026
@psschwei psschwei added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks May 22, 2026
@psschwei psschwei enabled auto-merge May 22, 2026 12:49
@psschwei psschwei closed this May 22, 2026
auto-merge was automatically disabled May 22, 2026 13:32

Pull request was closed

@psschwei psschwei reopened this May 22, 2026
@psschwei psschwei enabled auto-merge May 22, 2026 13:32
@psschwei psschwei added this pull request to the merge queue May 22, 2026
Merged via the queue into generative-computing:main with commit 9bbf25d May 22, 2026
13 checks passed
@ajbozarth ajbozarth deleted the chore/dco-precommit-hook branch May 22, 2026 15:37
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.

3 participants