You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
Bump and changelog using commitizen
0.7.0
Add commitizen incredibly fast into your project!
- Allow prerelease
- Super easy to setup
- Automatically bump version
- Automatically create changelog
- Update any file in your repo with the new version
Are you using conventional commits and semver?
Then you are ready to use this github action, the only thing you'll need is the
.cz.toml
file in your project.
- In your repository create a
.cz.toml
file (you can runcz init
to create it) - Create a
.github/workflows/bumpversion.yaml
with the Sample Workflow
Your .cz.toml
(or pyproject.toml
if you are using python) should look like
this.
[tool.commitizen]
version = "0.1.0" # This should be your current semver version
For more information visit commitizen's configuration page
name: Bump version
on:
push:
branches:
- master
jobs:
bump_version:
if: "!startsWith(github.event.head_commit.message, 'bump:')"
runs-on: ubuntu-latest
name: "Bump version and create changelog with commitizen"
steps:
- name: Check out
uses: actions/checkout@v2
with:
fetch-depth: 0
token: "${{ secrets.GITHUB_TOKEN }}"
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Name | Description | Default |
---|---|---|
github_token |
Token for the repo. Can be passed in using ${{ secrets.GITHUB_TOKEN }} required |
- |
dry_run |
Run without creating commit, output to stdout | false |
repository |
Repository name to push. Default or empty value represents current github repository | current one |
branch |
Destination branch to push changes | master |
prerelease |
Set as prerelease {alpha,beta,rc} choose type of prerelease | - |
extra_requirements |
Custom requirements, if your project uses a custom rule or plugins, you can specify them separated by a space. E.g: 'commitizen-emoji conventional-JIRA' |
- |
changelog_increment_filename |
Filename to store the incremented generated changelog. This is different to changelog as it only contains the changes for the just generated version. Example: body.md |
- |
This problem occurs because secrets.GITHUB_TOKEN
does not trigger other
actions by design.
To solve it you must use a personal access token in the checkout and the commitizen steps.
Follow the instructions in commitizen's documentation
If your rules can be parsed then you can build your own commitizen rules, you can
create a new commitizen python package or you can describe it on the toml
conf itself.