Skip to content

Commit c69a90e

Browse files
authored
Merge branch 'master' into feat/support-for-pep-751
2 parents 7616956 + 1d89cc5 commit c69a90e

81 files changed

Lines changed: 2564 additions & 1959 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/commitizen/SKILL.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
name: commitizen
3+
description: Use this skill for tasks involving Conventional Commits, commit message validation, Commitizen configuration, semantic version bumps, changelog generation, or CI/release automation with the Commitizen CLI.
4+
license: MIT
5+
compatibility: Git repository with Python and Commitizen available as `cz` or runnable from source. Network access is optional and mainly relevant for CI or release integrations.
6+
metadata:
7+
project: commitizen-tools/commitizen
8+
docs: https://commitizen-tools.github.io/commitizen/
9+
install: "pip install commitizen"
10+
---
11+
12+
# Commitizen
13+
14+
Commitizen is a CLI for enforcing Conventional Commits, automating version bumps, and generating changelogs.
15+
16+
## Use this skill when
17+
18+
- A task involves commit message authoring or validation.
19+
- A repository needs Commitizen initialization or configuration updates.
20+
- Work depends on version schemes, version providers, version files, tags, or changelog behavior.
21+
- CI/CD automation needs commit validation, automated version bumps, or release notes.
22+
23+
## Core workflow
24+
25+
1. Find the active configuration file in this order: `.cz.toml`, `cz.toml`, `.cz.json`, `cz.json`, `.cz.yaml`, `cz.yaml`, then `pyproject.toml` under `[tool.commitizen]`.
26+
2. Read the effective settings before acting, especially `name`, `version`, `version_provider`, `version_scheme`, `version_files`, `tag_format`, `update_changelog_on_bump`, `annotated_tag`, `bump_message`, `pre_bump_hooks`, and `post_bump_hooks`.
27+
3. Match the command to the task:
28+
- `cz commit` for interactive commit authoring
29+
- `cz check` for validating commit messages or git ranges
30+
- `cz init` for bootstrapping configuration
31+
- `cz bump` for calculating or applying release versions
32+
- `cz changelog` for generating or updating `CHANGELOG.md`
33+
- `cz ls` for listing available commit rules
34+
- `cz version` for showing the current version
35+
4. Prefer read-only inspection first. Safe discovery commands include `cz version`, `cz ls`, `cz check`, `cz bump --get-next`, and `cz bump --dry-run`.
36+
5. Treat `cz bump` as stateful: it can update version files, create a bump commit, and create a git tag. Verify the version provider, version scheme, tag format, and changelog settings before running it for real.
37+
6. When automating in CI, check whether the workflow should ignore specific exit codes with `--no-raise` and whether `bump_message` should include skip-CI text.
38+
7. After making changes, validate the resulting configuration, commands, and automation against the repository's actual version scheme and provider.
39+
40+
## Important domain details
41+
42+
- Commitizen installs with `pip install commitizen` or `uv add commitizen`.
43+
- The default version scheme is PEP 440; `semver` and `semver2` are also supported.
44+
- Common version providers include `commitizen`, `pep621`, `poetry`, `cargo`, `npm`, `composer`, `uv`, and `scm`.
45+
- `cz changelog` generates Markdown changelogs.
46+
- `cz commit` supports `--dry-run` and `--write-message-to-file`.
47+
- `cz check` can validate a literal message, a commit-msg file, or a git revision range.
48+
49+
## Suggested references
50+
51+
- Command docs:
52+
- `docs/commands/commit.md`
53+
- `docs/commands/bump.md`
54+
- `docs/commands/changelog.md`
55+
- `docs/commands/check.md`
56+
- `docs/commands/init.md`
57+
- Config docs:
58+
- `docs/config/configuration_file.md`
59+
- `docs/config/option.md`
60+
- `docs/config/bump.md`
61+
- Automation docs:
62+
- `docs/tutorials/github_actions.md`
63+
- `docs/tutorials/gitlab_ci.md`
64+
- Error handling:
65+
- `docs/exit_codes.md`
66+
67+
## Examples
68+
69+
- Validate one message: `cz check --message "feat(cli): add release command"`
70+
- Validate branch history: `cz check --rev-range master..HEAD`
71+
- Preview the next version: `cz bump --get-next`
72+
- Preview bump details: `cz bump --dry-run`
73+
- Preview changelog output: `cz changelog --dry-run`
74+
- Initialize configuration: `cz init`

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/bumpversion.yml

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,59 @@ jobs:
1010
if: ${{ github.repository == 'commitizen-tools/commitizen' && !startsWith(github.event.head_commit.message, 'bump:') }}
1111
runs-on: ubuntu-latest
1212
name: "Bump version and create changelog with commitizen"
13+
permissions:
14+
contents: write
15+
actions: write
1316
steps:
17+
- uses: actions/create-github-app-token@v3
18+
id: app-token
19+
with:
20+
app-id: ${{ vars.APP_ID }}
21+
private-key: ${{ secrets.PRIVATE_KEY }}
1422
- name: Check out
1523
uses: actions/checkout@v6
1624
with:
25+
token: ${{ steps.app-token.outputs.token }}
1726
fetch-depth: 0
18-
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
19-
- name: Create bump and changelog
20-
uses: commitizen-tools/commitizen-action@master
27+
fetch-tags: true
28+
- name: Get GitHub App User ID
29+
id: get-user-id
30+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
31+
env:
32+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
33+
- uses: commitizen-tools/setup-cz@main
2134
with:
22-
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
23-
changelog_increment_filename: body.md
35+
# Information extracted from the app token
36+
# Under actions/create-github-app-token is documented how to generate username and email for the bot
37+
git-user-name: "${{ steps.app-token.outputs.app-slug }}[bot]"
38+
git-user-email: "${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
39+
- id: bump-version
40+
run: |
41+
old_sha="$(git rev-parse HEAD)"
42+
cz --no-raise 21 bump --yes
43+
44+
if [ "$(git rev-parse HEAD)" = "$old_sha" ]; then
45+
echo "No bump-eligible commits found, skipping release."
46+
echo "bumped=false" >> $GITHUB_OUTPUT
47+
exit 0
48+
fi
49+
50+
echo "bumped=true" >> $GITHUB_OUTPUT
51+
git push --follow-tags
52+
new_version="$(cz version -p)"
53+
echo "new_version=$new_version" >> $GITHUB_OUTPUT
54+
new_version_tag="$(cz version -p --tag)"
55+
echo "new_version_tag=$new_version_tag" >> $GITHUB_OUTPUT
56+
- name: Build changelog for Release
57+
if: steps.bump-version.outputs.bumped == 'true'
58+
env:
59+
NEW_VERSION: ${{ steps.bump-version.outputs.new_version }}
60+
run: |
61+
cz changelog --dry-run "${NEW_VERSION}" > .changelog.md
2462
- name: Release
25-
uses: ncipollo/release-action@v1
26-
with:
27-
tag: v${{ env.REVISION }}
28-
bodyFile: "body.md"
29-
skipIfReleaseExists: true
63+
if: steps.bump-version.outputs.bumped == 'true'
64+
env:
65+
GH_TOKEN: ${{ github.token }}
66+
NEW_VERSION_TAG: ${{ steps.bump-version.outputs.new_version_tag }}
67+
run: |
68+
gh release create "${NEW_VERSION_TAG}" --notes-file .changelog.md

.github/workflows/docspublish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
4242
if [[ -n "$(git status --porcelain)" ]]; then
4343
git commit -m "docs(cli/screenshots): update CLI screenshots" -m "[skip ci]"
44+
git pull --rebase origin master
4445
git push
4546
else
4647
echo "No changes to commit. Skipping."

.github/workflows/label_issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
issues: write
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/github-script@v8
15+
- uses: actions/github-script@v9
1616
with:
1717
script: |
1818
const issue = await github.rest.issues.get({

.github/workflows/label_pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
configuration-path: .github/labeler.yml
2020
- name: Label based on PR title
21-
uses: actions/github-script@v8
21+
uses: actions/github-script@v9
2222
with:
2323
script: |
2424
const title = context.payload.pull_request.title.toLowerCase();

.github/workflows/links.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
- name: Broken Links Report
2626
if: steps.lychee.outputs.exit_code != 0 && github.event_name == 'schedule'
27-
uses: actions/github-script@v8
27+
uses: actions/github-script@v9
2828
with:
2929
script: |
3030
const fs = require('fs');

.github/workflows/pythonpackage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ jobs:
5858
uv run --no-sync poe ci
5959
shell: bash
6060
- name: Upload coverage to Codecov
61-
uses: codecov/codecov-action@v5
61+
uses: codecov/codecov-action@v6
6262
if: ${{ needs.detect_changes.outputs.relevant == 'true' }}
6363
with:
6464
token: ${{ secrets.CODECOV_TOKEN }}
6565
- name: Upload test results to Codecov
66-
uses: codecov/codecov-action@v5
66+
uses: codecov/codecov-action@v6
6767
if: ${{ needs.detect_changes.outputs.relevant == 'true' && !cancelled() }}
6868
with:
6969
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/pythonpublish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Upload Python Package
22

3+
# The tag is now triggered by the Github App: CommitizenBot
34
on:
45
push:
56
tags:
@@ -15,8 +16,8 @@ jobs:
1516
steps:
1617
- uses: actions/checkout@v6
1718
with:
18-
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
1919
fetch-depth: 0
20+
ref: ${{ github.ref_name }}
2021
- name: Set up Python
2122
uses: astral-sh/setup-uv@v7
2223
- name: Build

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ repos:
5656
- tomli
5757

5858
- repo: https://github.com/commitizen-tools/commitizen
59-
rev: v4.13.9 # automatically updated by Commitizen
59+
rev: v4.16.0 # automatically updated by Commitizen
6060
hooks:
6161
- id: commitizen
6262
- id: commitizen-branch

0 commit comments

Comments
 (0)