Skip to content
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
30 changes: 0 additions & 30 deletions .commit-check.yml

This file was deleted.

9 changes: 3 additions & 6 deletions .github/workflows/commit-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit
fetch-depth: 0 # fetch all history for all branches and tags
ref: ${{ github.event.pull_request.head.ref }} # Checkout PR branch
fetch-depth: 0 # Required for merge-base checks
- uses: ./ # self test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because of use pr-comments
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for PR comments
with:
Comment on lines +17 to 22
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore checkout fallback for non-PR runs.

github.event.pull_request.head.ref is undefined during workflow_dispatch, so checkout receives an empty ref and the workflow aborts on manual runs. Please fall back to github.ref_name/github.sha so both PR and dispatch executions work.

-          ref: ${{ github.event.pull_request.head.ref }}  # Checkout PR branch
+          ref: ${{ github.event.pull_request.head.ref || github.ref_name }}  # PR branch on PRs; dispatch/push fallback
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ref: ${{ github.event.pull_request.head.ref }} # Checkout PR branch
fetch-depth: 0 # Required for merge-base checks
- uses: ./ # self test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because of use pr-comments
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for PR comments
with:
ref: ${{ github.event.pull_request.head.ref || github.ref_name }} # PR branch on PRs; dispatch/push fallback
fetch-depth: 0 # Required for merge-base checks
- uses: ./ # self test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for PR comments
with:
🤖 Prompt for AI Agents
.github/workflows/commit-check.yml around lines 17 to 22: the checkout step
currently uses github.event.pull_request.head.ref which is undefined for
workflow_dispatch and causes failures; change the ref input to fall back to a
dispatch/commit ref by using a conditional expression that uses
github.event.pull_request.head.ref when present, otherwise github.ref_name (or
github.sha) so manual runs and PR runs both work; update the env/with block to
set ref: to that fallback expression (e.g. use the GitHub Actions expression OR
chain) so checkout always receives a valid ref.

message: true
branch: true
author-name: true
author-email: true
commit-signoff: true
merge-base: true
imperative: true
job-summary: true
pr-comments: ${{ github.event_name == 'pull_request' }}
12 changes: 6 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
inputs:
tag:
description: 'which tag to update to'
default: 'v1'
default: 'v2'
required: true
ref:
description: 'which branch to update the tag on'
Expand All @@ -36,10 +36,10 @@ jobs:
git push --delete origin ${{ inputs.tag }} || true
git tag -a ${{ inputs.tag }} -m 'Retag ${{ inputs.tag }}'
git push origin ${{ inputs.tag }}
- name: Update tag to v1
- name: Update tag to v2
if: github.event.inputs.tag == ''
run: |
git tag --delete v1 || true
git push --delete origin v1 || true
git tag -a v1 -m 'Retag v1'
git push origin v1
git tag --delete v2 || true
git push --delete origin v2 || true
git tag -a v2 -m 'Retag v2'
git push origin v2
57 changes: 22 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@

A GitHub Action for checking commit message formatting, branch naming, committer name, email, commit signoff, and more.

## What's New in v2

> [!IMPORTANT]
> This v2 release introduces several 🚨**breaking changes**. Please review the [Breaking Changes](#breaking-changes) section carefully before upgrading.

### Breaking Changes

- Removed support for `commit-signoff`, `merge-base`, and `imperative` inputs — now configured via `commit-check.toml` or `cchk.toml`.
- Deprecated `.commit-check.yml` in favor of `commit-check.toml` or `cchk.toml`.
- Changed default values of `author-name` and `author-email` inputs to `false` to align with the default behavior in commit-check.
- Upgraded core dependency [`commit-check`](https://github.com/commit-check/commit-check) to [**v2.0.0**](https://github.com/commit-check/commit-check/releases/tag/v2.0.0).

## Table of Contents

* [Usage](#usage)
Expand Down Expand Up @@ -38,19 +50,16 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit
fetch-depth: 0 # required for merge-base check
- uses: commit-check/commit-check-action@v1
ref: ${{ github.event.pull_request.head.ref }} # Checkout PR branch
fetch-depth: 0 # Required for merge-base checks
- uses: commit-check/commit-check-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because use of pr-comments
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for PR comments
with:
message: true
branch: true
author-name: true
author-email: true
commit-signoff: true
merge-base: false
imperative: false
author-name: false
author-email: false
job-summary: true
pr-comments: ${{ github.event_name == 'pull_request' }}
```
Expand Down Expand Up @@ -81,44 +90,22 @@ jobs:

### `message`

- **Description**: check commit message formatting convention.
- By default, the rule follows [Conventional Commits](https://www.conventionalcommits.org/).
- **Description**: check git commit message following [Conventional Commits](https://www.conventionalcommits.org/).
- Default: `true`

### `branch`

- **Description**: check git branch naming convention.
- By default, the rule follows [Conventional Branch](https://conventional-branch.github.io/).
- **Description**: check git branch name following [Conventional Branch](https://conventional-branch.github.io/).
- Default: `true`

### `author-name`

- **Description**: check committer author name.
- Default: `true`
- Default: `false`

### `author-email`

- **Description**: check committer author email.
- Default: `true`

### `commit-signoff`

- **Description**: check committer commit signature.
- Default: `true`

### `merge-base`

- **Description**: check current branch is rebased onto the target branch.
- Default: `false`

> [!IMPORTANT]
> `merge-base` is an experimental feature. By default, it's disabled.
>
> To use this feature, you need to fetch all history for all branches by setting `fetch-depth: 0` in `actions/checkout`.

### `imperative`

- **Description**: check commit message is imperative mood.
- Default: `false`

### `dry-run`
Expand All @@ -141,7 +128,7 @@ jobs:
>
> This feature currently doesn’t work with forked repositories. For more details, refer to issue [#77](https://github.com/commit-check/commit-check-action/issues/77).

Note: the default rule of above inputs is following [this configuration](https://github.com/commit-check/commit-check/blob/main/.commit-check.yml). If you want to customize, just add your `.commit-check.yml` config file under your repository root directory.
Note: the default rule of above inputs is following [this configuration](https://github.com/commit-check/commit-check-action/blob/main/commit-check.toml). If you want to customize, just add your [`commit-check.toml`](https://commit-check.github.io/commit-check/configuration.html) config file under your repository root directory.

## GitHub Action Job Summary

Expand Down
21 changes: 3 additions & 18 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,20 @@ branding:
color: "blue"
inputs:
message:
description: check commit message formatting convention
description: check git commit message following conventional commits
required: false
default: true
branch:
description: check git branch naming convention
description: check git branch name following conventional branch
required: false
default: true
author-name:
description: check committer author name
required: false
default: true
default: false
author-email:
description: check committer author email
required: false
default: true
commit-signoff:
description: check committer commit signature
required: false
default: true
merge-base:
description: check current branch is rebased onto target branch
required: false
default: false
imperative:
description: check commit message is in imperative mood
required: false
default: false
dry-run:
description: run checks without failing
Expand Down Expand Up @@ -78,9 +66,6 @@ runs:
BRANCH: ${{ inputs.branch }}
AUTHOR_NAME: ${{ inputs.author-name }}
AUTHOR_EMAIL: ${{ inputs.author-email }}
COMMIT_SIGNOFF: ${{ inputs.commit-signoff }}
MERGE_BASE: ${{ inputs.merge-base }}
IMPERATIVE: ${{ inputs.imperative }}
DRY_RUN: ${{ inputs.dry-run }}
JOB_SUMMARY: ${{ inputs.job-summary }}
PR_COMMENTS: ${{ inputs.pr-comments }}
23 changes: 23 additions & 0 deletions commit-check.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[commit]
# https://www.conventionalcommits.org
conventional_commits = true
subject_capitalized = false
subject_imperative = true
subject_max_length = 80
subject_min_length = 5
allow_commit_types = ["feat", "fix", "docs", "style", "refactor", "test", "chore", "ci"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore the full Conventional Commit type set.

We reference the Conventional Commits spec here, but allow_commit_types omits core types like build and perf. Any contributors using those standard types will now be blocked. Please add the missing spec-defined types so we don’t introduce false negatives.

-allow_commit_types = ["feat", "fix", "docs", "style", "refactor", "test", "chore", "ci"]
+allow_commit_types = ["feat", "fix", "docs", "style", "refactor", "test", "chore", "ci", "build", "perf"]
🤖 Prompt for AI Agents
In commit-check.toml at line 8, the allow_commit_types list omits standard
Conventional Commit types (e.g., build, perf, revert) which will block valid
commits; update the allow_commit_types array to include the missing spec-defined
types such as build, perf, and revert (in addition to the existing entries) so
the configuration accepts the full conventional set.

allow_merge_commits = true
allow_revert_commits = true
allow_empty_commits = false
allow_fixup_commits = true
allow_wip_commits = false
require_body = false
require_signed_off_by = false
ignore_authors = ["dependabot[bot]", "copilot[bot]", "pre-commit-ci[bot]"]

[branch]
# https://conventional-branch.github.io/
conventional_branch = true
allow_branch_types = ["feature", "bugfix", "hotfix", "release", "chore", "feat", "fix"]
require_rebase_target = "origin/main"
ignore_authors = ["dependabot[bot]", "copilot[bot]", "pre-commit-ci[bot]"]
12 changes: 0 additions & 12 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
BRANCH = os.getenv("BRANCH", "false")
AUTHOR_NAME = os.getenv("AUTHOR_NAME", "false")
AUTHOR_EMAIL = os.getenv("AUTHOR_EMAIL", "false")
COMMIT_SIGNOFF = os.getenv("COMMIT_SIGNOFF", "false")
MERGE_BASE = os.getenv("MERGE_BASE", "false")
IMPERATIVE = os.getenv("IMPERATIVE", "true")
DRY_RUN = os.getenv("DRY_RUN", "false")
JOB_SUMMARY = os.getenv("JOB_SUMMARY", "false")
PR_COMMENTS = os.getenv("PR_COMMENTS", "false")
Expand All @@ -33,9 +30,6 @@ def log_env_vars():
print(f"BRANCH = {BRANCH}")
print(f"AUTHOR_NAME = {AUTHOR_NAME}")
print(f"AUTHOR_EMAIL = {AUTHOR_EMAIL}")
print(f"COMMIT_SIGNOFF = {COMMIT_SIGNOFF}")
print(f"MERGE_BASE = {MERGE_BASE}")
print(f"IMPERATIVE = {IMPERATIVE}")
print(f"DRY_RUN = {DRY_RUN}")
print(f"JOB_SUMMARY = {JOB_SUMMARY}")
print(f"PR_COMMENTS = {PR_COMMENTS}\n")
Expand All @@ -48,9 +42,6 @@ def run_commit_check() -> int:
"--branch",
"--author-name",
"--author-email",
"--commit-signoff",
"--merge-base",
"--imperative",
]
args = [
arg
Expand All @@ -61,9 +52,6 @@ def run_commit_check() -> int:
BRANCH,
AUTHOR_NAME,
AUTHOR_EMAIL,
COMMIT_SIGNOFF,
MERGE_BASE,
IMPERATIVE,
],
)
if value == "true"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Install commit-check CLI
# For details please see: https://github.com/commit-check/commit-check
commit-check==0.10.2
commit-check==2.0.0
# Interact with the GitHub API.
PyGithub==2.8.1
Loading