Skip to content

Commit e47a8b0

Browse files
committed
Deploying to gh-pages from @ 40aa19d 🚀
1 parent 6c0c6e9 commit e47a8b0

11 files changed

Lines changed: 421 additions & 50 deletions

File tree

images/cli_interactive/bump.gif

859 Bytes
Loading

images/cli_interactive/commit.gif

23 Bytes
Loading

images/cli_interactive/init.gif

647 Bytes
Loading
-269 Bytes
Loading
837 Bytes
Loading

llms-full.txt

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3970,6 +3970,107 @@ jobs:
39703970

39713971
You can find the complete workflow in our repository at [bumpversion.yml](https://github.com/commitizen-tools/commitizen/blob/master/.github/workflows/bumpversion.yml).
39723972

3973+
### Previewing the version bump on pull requests
3974+
3975+
To help reviewers spot unexpected version bumps before merging, you can run `cz bump --dry-run` on every pull request and post (or update) a sticky comment summarizing the would-be version bump.
3976+
3977+
Create `.github/workflows/pr-bump-preview.yml`:
3978+
3979+
.github/workflows/pr-bump-preview.yml
3980+
3981+
````
3982+
name: PR bump preview
3983+
3984+
on:
3985+
pull_request_target:
3986+
types: [opened, reopened, synchronize, ready_for_review]
3987+
3988+
permissions:
3989+
contents: read
3990+
pull-requests: write
3991+
3992+
jobs:
3993+
bump-preview:
3994+
# Skip drafts and fork PRs (see "How it works" below).
3995+
if: >
3996+
${{
3997+
github.event.pull_request.draft == false &&
3998+
github.event.pull_request.head.repo.full_name ==
3999+
github.event.pull_request.base.repo.full_name
4000+
}}
4001+
runs-on: ubuntu-latest
4002+
steps:
4003+
- name: Check out PR head
4004+
uses: actions/checkout@v6
4005+
with:
4006+
ref: ${{ github.event.pull_request.head.sha }}
4007+
fetch-depth: 0
4008+
fetch-tags: true
4009+
persist-credentials: false
4010+
- uses: commitizen-tools/setup-cz@main
4011+
with:
4012+
set-git-config: false
4013+
- name: Run cz bump --dry-run
4014+
id: dry-run
4015+
run: |
4016+
set +e
4017+
output="$(cz bump --dry-run --yes 2>&1)"
4018+
status=$?
4019+
set -e
4020+
{
4021+
echo "status=${status}"
4022+
echo "output<<__CZ_BUMP_PREVIEW__"
4023+
printf '%s\n' "${output}"
4024+
echo "__CZ_BUMP_PREVIEW__"
4025+
} >> "$GITHUB_OUTPUT"
4026+
- name: Build comment body
4027+
env:
4028+
STATUS: ${{ steps.dry-run.outputs.status }}
4029+
OUTPUT: ${{ steps.dry-run.outputs.output }}
4030+
run: |
4031+
{
4032+
echo "<!-- commitizen-bump-preview -->"
4033+
echo "## 🔍 Commitizen bump preview"
4034+
echo ""
4035+
case "${STATUS}" in
4036+
0)
4037+
echo "Merging this PR will produce the following bump:"
4038+
echo ""
4039+
echo '```'
4040+
printf '%s\n' "${OUTPUT}"
4041+
echo '```'
4042+
;;
4043+
21)
4044+
echo "No commits in this PR are eligible for a version bump."
4045+
;;
4046+
*)
4047+
echo "⚠️ \`cz bump --dry-run\` exited with status \`${STATUS}\`:"
4048+
echo ""
4049+
echo '```'
4050+
printf '%s\n' "${OUTPUT}"
4051+
echo '```'
4052+
;;
4053+
esac
4054+
} > comment.md
4055+
- uses: peter-evans/create-or-update-comment@v4
4056+
with:
4057+
token: ${{ secrets.GITHUB_TOKEN }}
4058+
issue-number: ${{ github.event.pull_request.number }}
4059+
body-path: comment.md
4060+
body-includes: "<!-- commitizen-bump-preview -->"
4061+
edit-mode: replace
4062+
````
4063+
4064+
#### How it works
4065+
4066+
- **Trigger**: `pull_request_target` runs in the context of the base repository, which gives the workflow `pull-requests: write` permission even for PRs from forks. We deliberately gate the job to **same-repo PRs only** (`head.repo == base.repo`); fork PRs are skipped. This is because `cz bump` renders [Jinja templates from the working directory](https://github.com/commitizen-tools/commitizen/blob/master/commitizen/changelog.py) whenever [`update_changelog_on_bump`](https://commitizen-tools.github.io/commitizen/config/configuration_file/index.md) is enabled, and the renderer is not sandboxed — running it against fork-controlled files under a write token would risk arbitrary code execution and token exfiltration. Same-repo PRs are written by collaborators who already have push access, so the same risk doesn't apply.
4067+
- **Setup**: [`commitizen-tools/setup-cz`](https://github.com/commitizen-tools/setup-cz) installs the Commitizen CLI; no language-specific build tooling is required.
4068+
- **Defense in depth**: `persist-credentials: false` on `actions/checkout` keeps the workflow token out of the local git config.
4069+
- **Dry-run**: `cz bump --dry-run --yes` computes the next version (and, if `update_changelog_on_bump` is set in your config, also the changelog entries that would be produced). Exit code `21` (`NoneIncrementExit`) is treated as "no eligible bump" rather than a failure.
4070+
- **Sticky comment**: The hidden HTML marker `<!-- commitizen-bump-preview -->` lets [`peter-evans/create-or-update-comment`](https://github.com/peter-evans/create-or-update-comment) find and replace the previous preview on every push, instead of leaving a growing trail of comments.
4071+
4072+
You can find the complete workflow in our repository at [pr-bump-preview.yml](https://github.com/commitizen-tools/commitizen/blob/master/.github/workflows/pr-bump-preview.yml).
4073+
39734074
### Publishing a Python package
39744075

39754076
After a new version tag is created by the bump workflow, you can automatically publish your package to PyPI.

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

sitemap.xml

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,194 +2,194 @@
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
33
<url>
44
<loc>https://commitizen-tools.github.io/commitizen/</loc>
5-
<lastmod>2026-05-18</lastmod>
5+
<lastmod>2026-05-19</lastmod>
66
</url>
77
<url>
88
<loc>https://commitizen-tools.github.io/commitizen/exit_codes/</loc>
9-
<lastmod>2026-05-18</lastmod>
9+
<lastmod>2026-05-19</lastmod>
1010
</url>
1111
<url>
1212
<loc>https://commitizen-tools.github.io/commitizen/external_links/</loc>
13-
<lastmod>2026-05-18</lastmod>
13+
<lastmod>2026-05-19</lastmod>
1414
</url>
1515
<url>
1616
<loc>https://commitizen-tools.github.io/commitizen/faq/</loc>
17-
<lastmod>2026-05-18</lastmod>
17+
<lastmod>2026-05-19</lastmod>
1818
</url>
1919
<url>
2020
<loc>https://commitizen-tools.github.io/commitizen/features_wont_add/</loc>
21-
<lastmod>2026-05-18</lastmod>
21+
<lastmod>2026-05-19</lastmod>
2222
</url>
2323
<url>
2424
<loc>https://commitizen-tools.github.io/commitizen/history/</loc>
25-
<lastmod>2026-05-18</lastmod>
25+
<lastmod>2026-05-19</lastmod>
2626
</url>
2727
<url>
2828
<loc>https://commitizen-tools.github.io/commitizen/commands/bump/</loc>
29-
<lastmod>2026-05-18</lastmod>
29+
<lastmod>2026-05-19</lastmod>
3030
</url>
3131
<url>
3232
<loc>https://commitizen-tools.github.io/commitizen/commands/changelog/</loc>
33-
<lastmod>2026-05-18</lastmod>
33+
<lastmod>2026-05-19</lastmod>
3434
</url>
3535
<url>
3636
<loc>https://commitizen-tools.github.io/commitizen/commands/check/</loc>
37-
<lastmod>2026-05-18</lastmod>
37+
<lastmod>2026-05-19</lastmod>
3838
</url>
3939
<url>
4040
<loc>https://commitizen-tools.github.io/commitizen/commands/commit/</loc>
41-
<lastmod>2026-05-18</lastmod>
41+
<lastmod>2026-05-19</lastmod>
4242
</url>
4343
<url>
4444
<loc>https://commitizen-tools.github.io/commitizen/commands/example/</loc>
45-
<lastmod>2026-05-18</lastmod>
45+
<lastmod>2026-05-19</lastmod>
4646
</url>
4747
<url>
4848
<loc>https://commitizen-tools.github.io/commitizen/commands/info/</loc>
49-
<lastmod>2026-05-18</lastmod>
49+
<lastmod>2026-05-19</lastmod>
5050
</url>
5151
<url>
5252
<loc>https://commitizen-tools.github.io/commitizen/commands/init/</loc>
53-
<lastmod>2026-05-18</lastmod>
53+
<lastmod>2026-05-19</lastmod>
5454
</url>
5555
<url>
5656
<loc>https://commitizen-tools.github.io/commitizen/commands/ls/</loc>
57-
<lastmod>2026-05-18</lastmod>
57+
<lastmod>2026-05-19</lastmod>
5858
</url>
5959
<url>
6060
<loc>https://commitizen-tools.github.io/commitizen/commands/schema/</loc>
61-
<lastmod>2026-05-18</lastmod>
61+
<lastmod>2026-05-19</lastmod>
6262
</url>
6363
<url>
6464
<loc>https://commitizen-tools.github.io/commitizen/commands/version/</loc>
65-
<lastmod>2026-05-18</lastmod>
65+
<lastmod>2026-05-19</lastmod>
6666
</url>
6767
<url>
6868
<loc>https://commitizen-tools.github.io/commitizen/config/bump/</loc>
69-
<lastmod>2026-05-18</lastmod>
69+
<lastmod>2026-05-19</lastmod>
7070
</url>
7171
<url>
7272
<loc>https://commitizen-tools.github.io/commitizen/config/changelog/</loc>
73-
<lastmod>2026-05-18</lastmod>
73+
<lastmod>2026-05-19</lastmod>
7474
</url>
7575
<url>
7676
<loc>https://commitizen-tools.github.io/commitizen/config/check/</loc>
77-
<lastmod>2026-05-18</lastmod>
77+
<lastmod>2026-05-19</lastmod>
7878
</url>
7979
<url>
8080
<loc>https://commitizen-tools.github.io/commitizen/config/commit/</loc>
81-
<lastmod>2026-05-18</lastmod>
81+
<lastmod>2026-05-19</lastmod>
8282
</url>
8383
<url>
8484
<loc>https://commitizen-tools.github.io/commitizen/config/configuration_file/</loc>
85-
<lastmod>2026-05-18</lastmod>
85+
<lastmod>2026-05-19</lastmod>
8686
</url>
8787
<url>
8888
<loc>https://commitizen-tools.github.io/commitizen/config/option/</loc>
89-
<lastmod>2026-05-18</lastmod>
89+
<lastmod>2026-05-19</lastmod>
9090
</url>
9191
<url>
9292
<loc>https://commitizen-tools.github.io/commitizen/config/version_provider/</loc>
93-
<lastmod>2026-05-18</lastmod>
93+
<lastmod>2026-05-19</lastmod>
9494
</url>
9595
<url>
9696
<loc>https://commitizen-tools.github.io/commitizen/contributing/contributing/</loc>
97-
<lastmod>2026-05-18</lastmod>
97+
<lastmod>2026-05-19</lastmod>
9898
</url>
9999
<url>
100100
<loc>https://commitizen-tools.github.io/commitizen/contributing/contributing_tldr/</loc>
101-
<lastmod>2026-05-18</lastmod>
101+
<lastmod>2026-05-19</lastmod>
102102
</url>
103103
<url>
104104
<loc>https://commitizen-tools.github.io/commitizen/contributing/pull_request/</loc>
105-
<lastmod>2026-05-18</lastmod>
105+
<lastmod>2026-05-19</lastmod>
106106
</url>
107107
<url>
108108
<loc>https://commitizen-tools.github.io/commitizen/customization/changelog_template/</loc>
109-
<lastmod>2026-05-18</lastmod>
109+
<lastmod>2026-05-19</lastmod>
110110
</url>
111111
<url>
112112
<loc>https://commitizen-tools.github.io/commitizen/customization/config_file/</loc>
113-
<lastmod>2026-05-18</lastmod>
113+
<lastmod>2026-05-19</lastmod>
114114
</url>
115115
<url>
116116
<loc>https://commitizen-tools.github.io/commitizen/customization/python_class/</loc>
117-
<lastmod>2026-05-18</lastmod>
117+
<lastmod>2026-05-19</lastmod>
118118
</url>
119119
<url>
120120
<loc>https://commitizen-tools.github.io/commitizen/third-party-plugins/about/</loc>
121-
<lastmod>2026-05-18</lastmod>
121+
<lastmod>2026-05-19</lastmod>
122122
</url>
123123
<url>
124124
<loc>https://commitizen-tools.github.io/commitizen/third-party-plugins/commitizen-deno-provider/</loc>
125-
<lastmod>2026-05-18</lastmod>
125+
<lastmod>2026-05-19</lastmod>
126126
</url>
127127
<url>
128128
<loc>https://commitizen-tools.github.io/commitizen/third-party-plugins/commitizen-emoji/</loc>
129-
<lastmod>2026-05-18</lastmod>
129+
<lastmod>2026-05-19</lastmod>
130130
</url>
131131
<url>
132132
<loc>https://commitizen-tools.github.io/commitizen/third-party-plugins/conventional-jira/</loc>
133-
<lastmod>2026-05-18</lastmod>
133+
<lastmod>2026-05-19</lastmod>
134134
</url>
135135
<url>
136136
<loc>https://commitizen-tools.github.io/commitizen/third-party-plugins/cz-ai/</loc>
137-
<lastmod>2026-05-18</lastmod>
137+
<lastmod>2026-05-19</lastmod>
138138
</url>
139139
<url>
140140
<loc>https://commitizen-tools.github.io/commitizen/third-party-plugins/cz-conventional-gitmoji/</loc>
141-
<lastmod>2026-05-18</lastmod>
141+
<lastmod>2026-05-19</lastmod>
142142
</url>
143143
<url>
144144
<loc>https://commitizen-tools.github.io/commitizen/third-party-plugins/cz-emoji/</loc>
145-
<lastmod>2026-05-18</lastmod>
145+
<lastmod>2026-05-19</lastmod>
146146
</url>
147147
<url>
148148
<loc>https://commitizen-tools.github.io/commitizen/third-party-plugins/cz-legacy/</loc>
149-
<lastmod>2026-05-18</lastmod>
149+
<lastmod>2026-05-19</lastmod>
150150
</url>
151151
<url>
152152
<loc>https://commitizen-tools.github.io/commitizen/third-party-plugins/cz-path/</loc>
153-
<lastmod>2026-05-18</lastmod>
153+
<lastmod>2026-05-19</lastmod>
154154
</url>
155155
<url>
156156
<loc>https://commitizen-tools.github.io/commitizen/third-party-plugins/github-jira-conventional/</loc>
157-
<lastmod>2026-05-18</lastmod>
157+
<lastmod>2026-05-19</lastmod>
158158
</url>
159159
<url>
160160
<loc>https://commitizen-tools.github.io/commitizen/tutorials/auto_check/</loc>
161-
<lastmod>2026-05-18</lastmod>
161+
<lastmod>2026-05-19</lastmod>
162162
</url>
163163
<url>
164164
<loc>https://commitizen-tools.github.io/commitizen/tutorials/auto_prepare_commit_message/</loc>
165-
<lastmod>2026-05-18</lastmod>
165+
<lastmod>2026-05-19</lastmod>
166166
</url>
167167
<url>
168168
<loc>https://commitizen-tools.github.io/commitizen/tutorials/dev_releases/</loc>
169-
<lastmod>2026-05-18</lastmod>
169+
<lastmod>2026-05-19</lastmod>
170170
</url>
171171
<url>
172172
<loc>https://commitizen-tools.github.io/commitizen/tutorials/github_actions/</loc>
173-
<lastmod>2026-05-18</lastmod>
173+
<lastmod>2026-05-19</lastmod>
174174
</url>
175175
<url>
176176
<loc>https://commitizen-tools.github.io/commitizen/tutorials/gitlab_ci/</loc>
177-
<lastmod>2026-05-18</lastmod>
177+
<lastmod>2026-05-19</lastmod>
178178
</url>
179179
<url>
180180
<loc>https://commitizen-tools.github.io/commitizen/tutorials/jenkins_pipeline/</loc>
181-
<lastmod>2026-05-18</lastmod>
181+
<lastmod>2026-05-19</lastmod>
182182
</url>
183183
<url>
184184
<loc>https://commitizen-tools.github.io/commitizen/tutorials/monorepo_guidance/</loc>
185-
<lastmod>2026-05-18</lastmod>
185+
<lastmod>2026-05-19</lastmod>
186186
</url>
187187
<url>
188188
<loc>https://commitizen-tools.github.io/commitizen/tutorials/tag_format/</loc>
189-
<lastmod>2026-05-18</lastmod>
189+
<lastmod>2026-05-19</lastmod>
190190
</url>
191191
<url>
192192
<loc>https://commitizen-tools.github.io/commitizen/tutorials/writing_commits/</loc>
193-
<lastmod>2026-05-18</lastmod>
193+
<lastmod>2026-05-19</lastmod>
194194
</url>
195195
</urlset>

sitemap.xml.gz

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)