Skip to content

Commit d009e35

Browse files
authored
BREAKING CHNAGE: Upgrade commit-check to v2.0.0 (#152)
* BREAKING CHNAGES: upgrade commit-check to v2.0.0 * BREAKING CHNAGE: remove options * chore!: remove options * chore: update code comments * feat!: change default values and update docs * docs: update README.md * docs: update README.md * fix: update sha to ref * test: update require_rebase_target * docs: update README.md
1 parent 09d59e4 commit d009e35

File tree

8 files changed

+58
-108
lines changed

8 files changed

+58
-108
lines changed

.commit-check.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/commit-check.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,15 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v5
1616
with:
17-
ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit
18-
fetch-depth: 0 # fetch all history for all branches and tags
17+
ref: ${{ github.event.pull_request.head.ref }} # Checkout PR branch
18+
fetch-depth: 0 # Required for merge-base checks
1919
- uses: ./ # self test
2020
env:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because of use pr-comments
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for PR comments
2222
with:
2323
message: true
2424
branch: true
2525
author-name: true
2626
author-email: true
27-
commit-signoff: true
28-
merge-base: true
29-
imperative: true
3027
job-summary: true
3128
pr-comments: ${{ github.event_name == 'pull_request' }}

.github/workflows/release.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
inputs:
1111
tag:
1212
description: 'which tag to update to'
13-
default: 'v1'
13+
default: 'v2'
1414
required: true
1515
ref:
1616
description: 'which branch to update the tag on'
@@ -36,10 +36,10 @@ jobs:
3636
git push --delete origin ${{ inputs.tag }} || true
3737
git tag -a ${{ inputs.tag }} -m 'Retag ${{ inputs.tag }}'
3838
git push origin ${{ inputs.tag }}
39-
- name: Update tag to v1
39+
- name: Update tag to v2
4040
if: github.event.inputs.tag == ''
4141
run: |
42-
git tag --delete v1 || true
43-
git push --delete origin v1 || true
44-
git tag -a v1 -m 'Retag v1'
45-
git push origin v1
42+
git tag --delete v2 || true
43+
git push --delete origin v2 || true
44+
git tag -a v2 -m 'Retag v2'
45+
git push origin v2

README.md

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88

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

11+
## What's New in v2
12+
13+
> [!IMPORTANT]
14+
> This v2 release introduces several 🚨**breaking changes**. Please review the [Breaking Changes](#breaking-changes) section carefully before upgrading.
15+
16+
### Breaking Changes
17+
18+
- Removed support for `commit-signoff`, `merge-base`, and `imperative` inputs — now configured via `commit-check.toml` or `cchk.toml`.
19+
- Deprecated `.commit-check.yml` in favor of `commit-check.toml` or `cchk.toml`.
20+
- Changed default values of `author-name` and `author-email` inputs to `false` to align with the default behavior in commit-check.
21+
- 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).
22+
1123
## Table of Contents
1224

1325
* [Usage](#usage)
@@ -38,19 +50,16 @@ jobs:
3850
steps:
3951
- uses: actions/checkout@v5
4052
with:
41-
ref: ${{ github.event.pull_request.head.sha }} # checkout PR HEAD commit
42-
fetch-depth: 0 # required for merge-base check
43-
- uses: commit-check/commit-check-action@v1
53+
ref: ${{ github.event.pull_request.head.ref }} # Checkout PR branch
54+
fetch-depth: 0 # Required for merge-base checks
55+
- uses: commit-check/commit-check-action@v2
4456
env:
45-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because use of pr-comments
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for PR comments
4658
with:
4759
message: true
4860
branch: true
49-
author-name: true
50-
author-email: true
51-
commit-signoff: true
52-
merge-base: false
53-
imperative: false
61+
author-name: false
62+
author-email: false
5463
job-summary: true
5564
pr-comments: ${{ github.event_name == 'pull_request' }}
5665
```
@@ -81,44 +90,22 @@ jobs:
8190
8291
### `message`
8392

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

8896
### `branch`
8997

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

94101
### `author-name`
95102

96103
- **Description**: check committer author name.
97-
- Default: `true`
104+
- Default: `false`
98105

99106
### `author-email`
100107

101108
- **Description**: check committer author email.
102-
- Default: `true`
103-
104-
### `commit-signoff`
105-
106-
- **Description**: check committer commit signature.
107-
- Default: `true`
108-
109-
### `merge-base`
110-
111-
- **Description**: check current branch is rebased onto the target branch.
112-
- Default: `false`
113-
114-
> [!IMPORTANT]
115-
> `merge-base` is an experimental feature. By default, it's disabled.
116-
>
117-
> To use this feature, you need to fetch all history for all branches by setting `fetch-depth: 0` in `actions/checkout`.
118-
119-
### `imperative`
120-
121-
- **Description**: check commit message is imperative mood.
122109
- Default: `false`
123110

124111
### `dry-run`
@@ -141,7 +128,7 @@ jobs:
141128
>
142129
> 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).
143130

144-
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.
131+
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.
145132

146133
## GitHub Action Job Summary
147134

action.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,20 @@ branding:
66
color: "blue"
77
inputs:
88
message:
9-
description: check commit message formatting convention
9+
description: check git commit message following conventional commits
1010
required: false
1111
default: true
1212
branch:
13-
description: check git branch naming convention
13+
description: check git branch name following conventional branch
1414
required: false
1515
default: true
1616
author-name:
1717
description: check committer author name
1818
required: false
19-
default: true
19+
default: false
2020
author-email:
2121
description: check committer author email
2222
required: false
23-
default: true
24-
commit-signoff:
25-
description: check committer commit signature
26-
required: false
27-
default: true
28-
merge-base:
29-
description: check current branch is rebased onto target branch
30-
required: false
31-
default: false
32-
imperative:
33-
description: check commit message is in imperative mood
34-
required: false
3523
default: false
3624
dry-run:
3725
description: run checks without failing
@@ -78,9 +66,6 @@ runs:
7866
BRANCH: ${{ inputs.branch }}
7967
AUTHOR_NAME: ${{ inputs.author-name }}
8068
AUTHOR_EMAIL: ${{ inputs.author-email }}
81-
COMMIT_SIGNOFF: ${{ inputs.commit-signoff }}
82-
MERGE_BASE: ${{ inputs.merge-base }}
83-
IMPERATIVE: ${{ inputs.imperative }}
8469
DRY_RUN: ${{ inputs.dry-run }}
8570
JOB_SUMMARY: ${{ inputs.job-summary }}
8671
PR_COMMENTS: ${{ inputs.pr-comments }}

commit-check.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[commit]
2+
# https://www.conventionalcommits.org
3+
conventional_commits = true
4+
subject_capitalized = false
5+
subject_imperative = true
6+
subject_max_length = 80
7+
subject_min_length = 5
8+
allow_commit_types = ["feat", "fix", "docs", "style", "refactor", "test", "chore", "ci"]
9+
allow_merge_commits = true
10+
allow_revert_commits = true
11+
allow_empty_commits = false
12+
allow_fixup_commits = true
13+
allow_wip_commits = false
14+
require_body = false
15+
require_signed_off_by = false
16+
ignore_authors = ["dependabot[bot]", "copilot[bot]", "pre-commit-ci[bot]"]
17+
18+
[branch]
19+
# https://conventional-branch.github.io/
20+
conventional_branch = true
21+
allow_branch_types = ["feature", "bugfix", "hotfix", "release", "chore", "feat", "fix"]
22+
require_rebase_target = "origin/main"
23+
ignore_authors = ["dependabot[bot]", "copilot[bot]", "pre-commit-ci[bot]"]

main.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
BRANCH = os.getenv("BRANCH", "false")
1616
AUTHOR_NAME = os.getenv("AUTHOR_NAME", "false")
1717
AUTHOR_EMAIL = os.getenv("AUTHOR_EMAIL", "false")
18-
COMMIT_SIGNOFF = os.getenv("COMMIT_SIGNOFF", "false")
19-
MERGE_BASE = os.getenv("MERGE_BASE", "false")
20-
IMPERATIVE = os.getenv("IMPERATIVE", "true")
2118
DRY_RUN = os.getenv("DRY_RUN", "false")
2219
JOB_SUMMARY = os.getenv("JOB_SUMMARY", "false")
2320
PR_COMMENTS = os.getenv("PR_COMMENTS", "false")
@@ -33,9 +30,6 @@ def log_env_vars():
3330
print(f"BRANCH = {BRANCH}")
3431
print(f"AUTHOR_NAME = {AUTHOR_NAME}")
3532
print(f"AUTHOR_EMAIL = {AUTHOR_EMAIL}")
36-
print(f"COMMIT_SIGNOFF = {COMMIT_SIGNOFF}")
37-
print(f"MERGE_BASE = {MERGE_BASE}")
38-
print(f"IMPERATIVE = {IMPERATIVE}")
3933
print(f"DRY_RUN = {DRY_RUN}")
4034
print(f"JOB_SUMMARY = {JOB_SUMMARY}")
4135
print(f"PR_COMMENTS = {PR_COMMENTS}\n")
@@ -48,9 +42,6 @@ def run_commit_check() -> int:
4842
"--branch",
4943
"--author-name",
5044
"--author-email",
51-
"--commit-signoff",
52-
"--merge-base",
53-
"--imperative",
5445
]
5546
args = [
5647
arg
@@ -61,9 +52,6 @@ def run_commit_check() -> int:
6152
BRANCH,
6253
AUTHOR_NAME,
6354
AUTHOR_EMAIL,
64-
COMMIT_SIGNOFF,
65-
MERGE_BASE,
66-
IMPERATIVE,
6755
],
6856
)
6957
if value == "true"

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Install commit-check CLI
22
# For details please see: https://github.com/commit-check/commit-check
3-
commit-check==0.10.2
3+
commit-check==2.0.0
44
# Interact with the GitHub API.
55
PyGithub==2.8.1

0 commit comments

Comments
 (0)