Skip to content

Commit 776496a

Browse files
committed
feat: add commit-check reusable workflow and org-level config
- Add cchk.toml as the organization-level base config for inherit_from - Add commit-check reusable workflow (.github/workflows/commit-check.yml) for other repositories to consume - Add commit-check-self.yml for the .github repo to eat its own dog food The cchk.toml serves as the shared base config that other repos can inherit via: inherit_from = "github:commit-check/.github:cchk.toml" Other repos can reuse the workflow by calling: commit-check/.github/.github/workflows/commit-check.yml@main
1 parent 570a4bb commit 776496a

3 files changed

Lines changed: 118 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Commit Check (self)
2+
3+
on:
4+
push:
5+
branches: 'main'
6+
pull_request:
7+
branches: 'main'
8+
types: [opened, synchronize, reopened, edited]
9+
10+
concurrency:
11+
group: commit-check-self-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
commit-check:
16+
name: commit-check
17+
uses: ./.github/workflows/commit-check.yml
18+
with:
19+
message: true
20+
branch: true
21+
author-name: true
22+
author-email: true
23+
job-summary: true
24+
pr-comments: ${{ github.event_name == 'pull_request' }}
25+
pr-title: true

.github/workflows/commit-check.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Commit Check
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
message:
7+
description: Check git commit message following Conventional Commits
8+
required: false
9+
type: boolean
10+
default: true
11+
branch:
12+
description: Check git branch name following Conventional Branch
13+
required: false
14+
type: boolean
15+
default: true
16+
author-name:
17+
description: Check committer author name
18+
required: false
19+
type: boolean
20+
default: false
21+
author-email:
22+
description: Check committer author email
23+
required: false
24+
type: boolean
25+
default: false
26+
dry-run:
27+
description: Run checks without failing
28+
required: false
29+
type: boolean
30+
default: false
31+
job-summary:
32+
description: Display job summary to the workflow run
33+
required: false
34+
type: boolean
35+
default: true
36+
pr-comments:
37+
description: Post results to the pull request comments
38+
required: false
39+
type: boolean
40+
default: false
41+
pr-title:
42+
description: Check pull request title following Conventional Commits
43+
required: false
44+
type: boolean
45+
default: false
46+
47+
concurrency:
48+
group: commit-check-${{ github.ref }}
49+
cancel-in-progress: true
50+
51+
jobs:
52+
commit-check:
53+
runs-on: ubuntu-latest
54+
permissions:
55+
contents: read
56+
pull-requests: write
57+
steps:
58+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59+
with:
60+
fetch-depth: 0 # Required for merge-base checks
61+
- uses: commit-check/commit-check-action@v2
62+
with:
63+
message: ${{ inputs.message }}
64+
branch: ${{ inputs.branch }}
65+
author-name: ${{ inputs.author-name }}
66+
author-email: ${{ inputs.author-email }}
67+
dry-run: ${{ inputs.dry-run }}
68+
job-summary: ${{ inputs.job-summary }}
69+
pr-comments: ${{ inputs.pr-comments && github.event_name == 'pull_request' }}
70+
pr-title: ${{ inputs.pr-title }}

cchk.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 = 100
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]", "coderabbitai[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", "ai", "claude", "codex", "copilot", "cursor"]
22+
require_rebase_target = "main"
23+
ignore_authors = ["dependabot[bot]", "copilot[bot]", "pre-commit-ci[bot]", "shenxianpeng"]

0 commit comments

Comments
 (0)