From f5fc99ed57bf52fde52c1c1f385fdf27edc45850 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Mon, 13 Oct 2025 10:05:53 +0300 Subject: [PATCH 01/10] BREAKING CHNAGES: upgrade commit-check to v2.0.0 --- .commit-check.yml | 30 ------------------------------ .github/workflows/release.yaml | 12 ++++++------ README.md | 2 +- commit-check.toml | 23 +++++++++++++++++++++++ requirements.txt | 2 +- 5 files changed, 31 insertions(+), 38 deletions(-) delete mode 100644 .commit-check.yml create mode 100644 commit-check.toml diff --git a/.commit-check.yml b/.commit-check.yml deleted file mode 100644 index f1f725f..0000000 --- a/.commit-check.yml +++ /dev/null @@ -1,30 +0,0 @@ -checks: - - - check: message - regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)|(Merge).*|(fixup!.*)' - error: "The commit message should be structured as follows:\n\n - [optional scope]: \n - [optional body]\n - [optional footer(s)]\n\n - More details please refer to https://www.conventionalcommits.org" - suggest: please check your commit message whether matches above regex - - - check: branch - regex: ^(bugfix|feature|release|hotfix|task|chore)\/.+|(master)|(main)|(HEAD)|(PR-.+) - error: "Branches must begin with these types: bugfix/ feature/ release/ hotfix/ task/ chore/" - suggest: run command `git checkout -b type/branch_name` - - - check: author_name - regex: ^[A-Za-zÀ-ÖØ-öø-ÿ\u0100-\u017F\u0180-\u024F ,.\'-]+$|.*(\[bot]) - error: The committer name seems invalid - suggest: run command `git config user.name "Your Name"` - - - check: author_email - regex: ^.+@.+$ - error: The committer email seems invalid - suggest: run command `git config user.email yourname@example.com` - - - check: merge_base - regex: main # it can be master, develop, devel etc based on your project. - error: Current branch is not rebased onto target branch - suggest: please ensure your branch is rebased with the target branch diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 10087ef..54b1e22 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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' @@ -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 diff --git a/README.md b/README.md index 1feaa9c..8b74943 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ jobs: 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 + - uses: commit-check/commit-check-action@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # use GITHUB_TOKEN because use of pr-comments with: diff --git a/commit-check.toml b/commit-check.toml new file mode 100644 index 0000000..20f472a --- /dev/null +++ b/commit-check.toml @@ -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"] +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 = "main" +ignore_authors = ["dependabot[bot]", "copilot[bot]", "pre-commit-ci[bot]"] diff --git a/requirements.txt b/requirements.txt index 133fa28..27bbca8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 From 01d98b64b7506a2504ff5a1ca4398f98696a2b7b Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Mon, 13 Oct 2025 10:13:46 +0300 Subject: [PATCH 02/10] BREAKING CHNAGE: remove options --- README.md | 23 ----------------------- action.yml | 15 --------------- main.py | 12 ------------ 3 files changed, 50 deletions(-) diff --git a/README.md b/README.md index 8b74943..a40b77f 100644 --- a/README.md +++ b/README.md @@ -48,9 +48,6 @@ jobs: branch: true author-name: true author-email: true - commit-signoff: true - merge-base: false - imperative: false job-summary: true pr-comments: ${{ github.event_name == 'pull_request' }} ``` @@ -101,26 +98,6 @@ jobs: - **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` - **Description**: run checks without failing. exit code is 0; otherwise is 1. diff --git a/action.yml b/action.yml index eb12512..8c5bf14 100644 --- a/action.yml +++ b/action.yml @@ -21,18 +21,6 @@ inputs: 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 required: false @@ -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 }} diff --git a/main.py b/main.py index 8a57c64..2ec7ea5 100755 --- a/main.py +++ b/main.py @@ -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") @@ -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") @@ -48,9 +42,6 @@ def run_commit_check() -> int: "--branch", "--author-name", "--author-email", - "--commit-signoff", - "--merge-base", - "--imperative", ] args = [ arg @@ -61,9 +52,6 @@ def run_commit_check() -> int: BRANCH, AUTHOR_NAME, AUTHOR_EMAIL, - COMMIT_SIGNOFF, - MERGE_BASE, - IMPERATIVE, ], ) if value == "true" From 70a31f4e91e5c3f81199f4157d398c126094a2c2 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Mon, 13 Oct 2025 10:14:28 +0300 Subject: [PATCH 03/10] chore!: remove options --- .github/workflows/commit-check.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index b22e048..3cd6350 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -24,8 +24,5 @@ jobs: 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' }} From 4e5410a82e247589f89bb25629ebcdd4685ad2f3 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Mon, 13 Oct 2025 23:26:10 +0300 Subject: [PATCH 04/10] chore: update code comments --- .github/workflows/commit-check.yml | 6 +++--- README.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index 3cd6350..dc3421a 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -14,11 +14,11 @@ 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.sha }} # Checkout PR HEAD commit + 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: message: true branch: true diff --git a/README.md b/README.md index a40b77f..a3b51be 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,11 @@ 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 + ref: ${{ github.event.pull_request.head.sha }} # Checkout PR HEAD commit + 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 From 2d5dfe0fde9d72c36a15cc99ec575083a39edcad Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 14 Oct 2025 00:11:27 +0300 Subject: [PATCH 05/10] feat!: change default values and update docs --- README.md | 34 +++++++++++++++++++++++++--------- action.yml | 8 ++++---- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a3b51be..2d05795 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,24 @@ A GitHub Action for checking commit message formatting, branch naming, committer name, email, commit signoff, and more. +## What's New? + +> [!NOTE] +> **Version:** `v2.0.0` — *2025-10-20* + +> [!IMPORTANT] +> This release introduces several **breaking changes**. Please review the [Breaking Changes](#breaking-changes) section before upgrading. + +### Breaking Changes + +- Dropped support for `commit-signoff`, `merge-base`, and `imperative` inputs which are moved to new config file `commit-check.toml`. +- Dropped support for `.commit-check.yml` in favor of `commit-check.toml`. +- Changed default values of `author-name` and `author-email` inputs to `false` to align with commit-check default configuration. +- Updated core dependency [`commit-check`](https://github.com/commit-check/commit-check) to **v2.0.0**. + +> [!TIP] +> For migration guidance, see the [v2.0.0 Upgrade Guide](https://commit-check.github.io/commit-check/migration.html). + ## Table of Contents * [Usage](#usage) @@ -46,8 +64,8 @@ jobs: with: message: true branch: true - author-name: true - author-email: true + author-name: false + author-email: false job-summary: true pr-comments: ${{ github.event_name == 'pull_request' }} ``` @@ -78,25 +96,23 @@ 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` +- Default: `false` ### `dry-run` @@ -118,7 +134,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 diff --git a/action.yml b/action.yml index 8c5bf14..68df492 100644 --- a/action.yml +++ b/action.yml @@ -6,21 +6,21 @@ 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 + default: false dry-run: description: run checks without failing required: false From 6cbe8b59a2208652a8fb2ea2e320b00ed0698c07 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 14 Oct 2025 00:15:35 +0300 Subject: [PATCH 06/10] docs: update README.md --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2d05795..22456de 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,9 @@ A GitHub Action for checking commit message formatting, branch naming, committer ## What's New? -> [!NOTE] -> **Version:** `v2.0.0` — *2025-10-20* - > [!IMPORTANT] +> **Version:** `v2.0.0` — *2025-10-20* +> > This release introduces several **breaking changes**. Please review the [Breaking Changes](#breaking-changes) section before upgrading. ### Breaking Changes @@ -23,8 +22,7 @@ A GitHub Action for checking commit message formatting, branch naming, committer - Changed default values of `author-name` and `author-email` inputs to `false` to align with commit-check default configuration. - Updated core dependency [`commit-check`](https://github.com/commit-check/commit-check) to **v2.0.0**. -> [!TIP] -> For migration guidance, see the [v2.0.0 Upgrade Guide](https://commit-check.github.io/commit-check/migration.html). +More details can be found in the [release notes](https://github.com/commit-check/commit-check/releases/tag/v2.0.0). ## Table of Contents From 1f6c524a83646503d739372069f301020038ba21 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 14 Oct 2025 00:18:15 +0300 Subject: [PATCH 07/10] docs: update README.md --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 22456de..a40be75 100644 --- a/README.md +++ b/README.md @@ -8,21 +8,17 @@ A GitHub Action for checking commit message formatting, branch naming, committer name, email, commit signoff, and more. -## What's New? +## What's New in v2 > [!IMPORTANT] -> **Version:** `v2.0.0` — *2025-10-20* -> -> This release introduces several **breaking changes**. Please review the [Breaking Changes](#breaking-changes) section before upgrading. +> This v2 release introduces several **breaking changes**. Please review the [Breaking Changes](#breaking-changes) section before upgrading. ### Breaking Changes - Dropped support for `commit-signoff`, `merge-base`, and `imperative` inputs which are moved to new config file `commit-check.toml`. - Dropped support for `.commit-check.yml` in favor of `commit-check.toml`. - Changed default values of `author-name` and `author-email` inputs to `false` to align with commit-check default configuration. -- Updated core dependency [`commit-check`](https://github.com/commit-check/commit-check) to **v2.0.0**. - -More details can be found in the [release notes](https://github.com/commit-check/commit-check/releases/tag/v2.0.0). +- Updated 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 From 31b487177035775024c44b08d7f4206c2a32a839 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 14 Oct 2025 00:24:39 +0300 Subject: [PATCH 08/10] fix: update sha to ref --- .github/workflows/commit-check.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml index dc3421a..01ee50a 100644 --- a/.github/workflows/commit-check.yml +++ b/.github/workflows/commit-check.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v5 with: - ref: ${{ github.event.pull_request.head.sha }} # Checkout PR HEAD commit + ref: ${{ github.event.pull_request.head.ref }} # Checkout PR branch fetch-depth: 0 # Required for merge-base checks - uses: ./ # self test env: diff --git a/README.md b/README.md index a40be75..8abf5f5 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ jobs: steps: - uses: actions/checkout@v5 with: - ref: ${{ github.event.pull_request.head.sha }} # Checkout PR HEAD commit + 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: From eb895f4738744bfd18f2185eb76683435ffba08a Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 14 Oct 2025 00:49:32 +0300 Subject: [PATCH 09/10] test: update require_rebase_target --- commit-check.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commit-check.toml b/commit-check.toml index 20f472a..5eec90c 100644 --- a/commit-check.toml +++ b/commit-check.toml @@ -19,5 +19,5 @@ ignore_authors = ["dependabot[bot]", "copilot[bot]", "pre-commit-ci[bot]"] # https://conventional-branch.github.io/ conventional_branch = true allow_branch_types = ["feature", "bugfix", "hotfix", "release", "chore", "feat", "fix"] -require_rebase_target = "main" +require_rebase_target = "origin/main" ignore_authors = ["dependabot[bot]", "copilot[bot]", "pre-commit-ci[bot]"] From d36e8785325e729212846ed83839937c1c391f6b Mon Sep 17 00:00:00 2001 From: Xianpeng Shen Date: Tue, 14 Oct 2025 09:35:24 +0300 Subject: [PATCH 10/10] docs: update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8abf5f5..f3d1c89 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,14 @@ A GitHub Action for checking commit message formatting, branch naming, committer ## What's New in v2 > [!IMPORTANT] -> This v2 release introduces several **breaking changes**. Please review the [Breaking Changes](#breaking-changes) section before upgrading. +> This v2 release introduces several 🚨**breaking changes**. Please review the [Breaking Changes](#breaking-changes) section carefully before upgrading. ### Breaking Changes -- Dropped support for `commit-signoff`, `merge-base`, and `imperative` inputs which are moved to new config file `commit-check.toml`. -- Dropped support for `.commit-check.yml` in favor of `commit-check.toml`. -- Changed default values of `author-name` and `author-email` inputs to `false` to align with commit-check default configuration. -- Updated 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). +- 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