Skip to content

Commit fb841e3

Browse files
committed
feat: add release and publish workflows
1 parent e239b1f commit fb841e3

9 files changed

Lines changed: 755 additions & 77 deletions

File tree

.github/labeler.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
feature:
2+
- head-branch:
3+
- "^feature/"
4+
- "^feat/"
5+
6+
fix:
7+
- head-branch:
8+
- "^fix/"
9+
- "^bugfix/"
10+
- "^hotfix/"
11+
12+
docs:
13+
- all:
14+
- head-branch:
15+
- "^docs/"
16+
- changed-files:
17+
- any-glob-to-any-file: "**/*.md"
18+
19+
chore:
20+
- head-branch:
21+
- "^chore/"
22+
- "^build/"
23+
24+
refactor:
25+
- head-branch:
26+
- "^refactor/"
27+
28+
test:
29+
- any:
30+
- head-branch:
31+
- "^test/"
32+
- changed-files:
33+
- any-glob-to-any-file: "tests/**"
34+
35+
ci:
36+
- any:
37+
- head-branch:
38+
- "^ci/"
39+
- changed-files:
40+
- any-glob-to-any-file: ".github/workflows/**"
41+
42+
dependencies:
43+
- head-branch:
44+
- "^deps/"
45+
- "^dependabot/"

.github/release-drafter.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name-template: "v$RESOLVED_VERSION"
2+
tag-template: "v$RESOLVED_VERSION"
3+
change-template: "- $TITLE by @$AUTHOR (#$NUMBER)"
4+
change-title-escapes: "\\<*_&`"
5+
no-changes-template: "- No user-facing changes in this release."
6+
template: |
7+
## What's Changed
8+
9+
$CHANGES
10+
11+
categories:
12+
- title: Features
13+
labels:
14+
- feature
15+
- title: Fixes
16+
labels:
17+
- fix
18+
- title: Documentation
19+
labels:
20+
- docs
21+
- title: Maintenance
22+
labels:
23+
- chore
24+
- refactor
25+
- test
26+
- ci
27+
- dependencies
28+
29+
exclude-labels:
30+
- skip-changelog
31+
32+
version-resolver:
33+
major:
34+
labels:
35+
- major
36+
- breaking
37+
minor:
38+
labels:
39+
- feature
40+
patch:
41+
labels:
42+
- fix
43+
- docs
44+
- chore
45+
- refactor
46+
- test
47+
- ci
48+
- dependencies
49+
default: patch

.github/workflows/labeler.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: PR Autolabeler
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
- edited
10+
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
15+
jobs:
16+
labeler:
17+
runs-on: ubuntu-24.04
18+
steps:
19+
- uses: actions/labeler@v5
20+
with:
21+
repo-token: ${{ secrets.GITHUB_TOKEN }}
22+
sync-labels: true

.github/workflows/main.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
paths:
9+
- "**.py"
10+
- "pyproject.toml"
11+
- "README.md"
12+
- ".github/workflows/**"
13+
- ".github/*.yml"
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
test:
21+
runs-on: ubuntu-24.04
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
python-version: ["3.10", "3.11", "3.12", "3.13"]
26+
steps:
27+
- uses: actions/checkout@v6
28+
- uses: actions/setup-python@v6
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
python -m pip install -e .[dev]
36+
37+
- name: Run tests
38+
run: python -m pytest -q
39+
40+
build:
41+
runs-on: ubuntu-24.04
42+
steps:
43+
- uses: actions/checkout@v6
44+
- uses: actions/setup-python@v6
45+
with:
46+
python-version: "3.12"
47+
48+
- name: Install build tooling
49+
run: |
50+
python -m pip install --upgrade pip
51+
python -m pip install build twine
52+
53+
- name: Build distributions
54+
run: python -m build
55+
56+
- name: Check distributions
57+
run: python -m twine check dist/*
58+
59+
- name: Upload distributions
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: dist
63+
path: dist/*
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: publish package
2+
3+
on:
4+
release:
5+
branches:
6+
- main
7+
types:
8+
- published
9+
workflow_dispatch:
10+
inputs:
11+
repository:
12+
description: "Target package index"
13+
required: true
14+
default: testpypi
15+
type: choice
16+
options:
17+
- testpypi
18+
- pypi
19+
20+
permissions:
21+
id-token: write
22+
attestations: write
23+
contents: read
24+
25+
jobs:
26+
build:
27+
runs-on: ubuntu-24.04
28+
outputs:
29+
artifact-name: python-package-distributions
30+
steps:
31+
- uses: actions/checkout@v6
32+
with:
33+
fetch-depth: 0
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v6
37+
with:
38+
python-version: "3.12"
39+
40+
- name: Build distributions
41+
run: |
42+
python -m pip install --upgrade pip
43+
python -m pip install build twine
44+
python -m build
45+
python -m twine check dist/*
46+
47+
- name: Upload distributions
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: python-package-distributions
51+
path: dist/*
52+
53+
- name: Create attestations
54+
uses: actions/attest-build-provenance@v3
55+
with:
56+
subject-path: "dist/*"
57+
58+
publish-testpypi:
59+
if: github.event_name == 'workflow_dispatch' && inputs.repository == 'testpypi'
60+
needs: build
61+
runs-on: ubuntu-24.04
62+
steps:
63+
- name: Download distributions
64+
uses: actions/download-artifact@v4
65+
with:
66+
name: python-package-distributions
67+
path: dist
68+
69+
- name: Publish package to TestPyPI
70+
env:
71+
TWINE_USERNAME: __token__
72+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
73+
run: python -m pip install --upgrade twine && python -m twine upload --repository testpypi dist/*
74+
75+
publish-pypi:
76+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.repository == 'pypi')
77+
needs: build
78+
runs-on: ubuntu-24.04
79+
steps:
80+
- name: Download distributions
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: python-package-distributions
84+
path: dist
85+
86+
- name: Publish package to PyPI
87+
env:
88+
TWINE_USERNAME: __token__
89+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
90+
run: python -m pip install --upgrade twine && python -m twine upload dist/*
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions: {}
10+
11+
jobs:
12+
draft-release:
13+
runs-on: ubuntu-24.04
14+
permissions:
15+
contents: write
16+
pull-requests: read
17+
steps:
18+
- uses: release-drafter/release-drafter@v6
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ This MCP server exposes commit-check validations as MCP tools:
88

99
- `server_health` — returns server/sdk versions
1010
- `validate_commit_message` — validates a commit message
11-
- `validate_branch_name` — validates a branch name
12-
- `validate_author_info` — validates author name/email
11+
- `validate_branch_name` — validates a branch name or the current repo branch
12+
- `validate_author_info` — validates author name/email or the repo's git author config
1313
- `validate_commit_context` — runs combined checks in one call
14+
- `validate_repository_state` — validates latest commit, current branch, and author state for a repo
15+
- `describe_validation_rules` — returns the effective config and enabled rules after merging defaults and repo config
1416

1517
All validation tools return the same structured commit-check result shape:
1618

@@ -42,3 +44,28 @@ commit-check-mcp
4244
```
4345

4446
The server runs over stdio transport (recommended MCP default for local tool integrations).
47+
48+
## Repository-Aware Validation
49+
50+
`commit-check` is most useful when it runs against a real git repository and its `cchk.toml` or `commit-check.toml` file. This MCP server now supports that directly:
51+
52+
- `repo_path` — run git-based validations against a specific repository
53+
- `config_path` — point to an explicit TOML config file; relative paths are resolved from `repo_path`
54+
- `config` — apply ad-hoc overrides on top of defaults and repo config
55+
56+
Typical patterns:
57+
58+
- Validate an explicit message with a repository's rules
59+
- Validate the current repository state without passing message/branch/author values manually
60+
- Inspect which rules are actually enabled after config merging
61+
62+
Example payload for a repository-wide validation:
63+
64+
```json
65+
{
66+
"repo_path": "/path/to/repo",
67+
"include_message": true,
68+
"include_branch": true,
69+
"include_author": true
70+
}
71+
```

0 commit comments

Comments
 (0)