Skip to content

feat: support new pre-commit hook check-merge-base #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ repos:
hooks:
- id: codespell
- repo: https://github.com/commit-check/commit-check
rev: v0.8.5
rev: v0.9.1
hooks:
- id: check-message
# - id: check-branch # uncomment if you need.
# - id: check-author-name # uncomment if you need.
# - id: check-author-email # uncomment if you need.
- id: check-author-name # uncomment if you need.
- id: check-author-email # uncomment if you need.
# - id: commit-signoff # uncomment if you need.
# - id: check-merge-base # uncomment if you need.
17 changes: 12 additions & 5 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
- id: check-message
name: check commit message
description: requiring commit message to match regex
description: ensures commit message to match regex
entry: commit-check
args: [--message]
pass_filenames: true
language: python
stages: [commit-msg, prepare-commit-msg]
- id: check-branch
name: check branch naming
description: requiring branch naming to match regex
description: ensures branch naming to match regex
entry: commit-check
args: [--branch]
pass_filenames: false
language: python
- id: check-author-name
name: check committer name
description: requiring committer name to match regex
description: ensures committer name to match regex
entry: commit-check
args: [--author-name]
pass_filenames: false
language: python
- id: check-author-email
name: check committer email
description: requiring committer email to match regex
description: ensures committer email to match regex
entry: commit-check
args: [--author-email]
pass_filenames: false
language: python
- id: check-commit-signoff
name: check committer signoff
description: requiring committer to add a Signed-off-by trailer
description: ensures committer to add a Signed-off-by trailer
entry: commit-check
args: [--commit-signoff]
pass_filenames: false
language: python
- id: check-merge-base
name: check merge base
description: ensures current branch is rebased onto target branch
entry: commit-check
args: [--merge-base]
pass_filenames: false
language: python
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Overview

**Commit Check** is a free, powerful tool that enforces commit metadata standards, including commit message, branch naming, committer name/email, and commit signoff. Fully customizable with error messages and suggested commands, it ensures compliance across teams.

As an alternative to GitHub Enerprise `Metadata restrictions <https://docs.github.com/en/enterprise-server@3.11/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets#metadata-restrictions>`_ and Bitbucket's paid puglin `Yet Another Commit Checker <https://marketplace.atlassian.com/apps/1211854/yet-another-commit-checker?tab=overview&hosting=datacenter>`_, Commit Check stands out by integrating DevOps principles and Infrastructure as Code (IaC).
As an alternative to GitHub Enterprise `Metadata restrictions <https://docs.github.com/en/enterprise-server@3.11/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets#metadata-restrictions>`_ and Bitbucket's paid puglin `Yet Another Commit Checker <https://marketplace.atlassian.com/apps/1211854/yet-another-commit-checker?tab=overview&hosting=datacenter>`_, Commit Check stands out by integrating DevOps principles and Infrastructure as Code (IaC).

Configuration
-------------
Expand Down Expand Up @@ -75,6 +75,7 @@ Running as pre-commit hook
- id: check-author-name
- id: check-author-email
- id: check-commit-signoff
- id: check-merge-base

Running as CLI
~~~~~~~~~~~~~~
Expand Down Expand Up @@ -107,7 +108,7 @@ To configure the hook, create a script file in the ``.git/hooks/`` directory.
.. code-block:: bash

#!/bin/sh
commit-check --message --branch --author-name --author-email
commit-check --message --branch --author-name --author-email --commit-signoff --merge-base

Save the script file as ``pre-push`` and make it executable:

Expand Down
Loading