commitizen-tools / commitizen-action

Commitizen github action to bump and create changelog
MIT License
73 stars 32 forks source link

Question: customise change_type_map from toml file #84

Closed renedekat closed 1 month ago

renedekat commented 1 month ago

Hi,

I am trying to change the change_type labels in changelog.md using the .cz.toml file .

.cz.toml

[tool.commitizen]
version = "1.0.0"
template = ".github/templates/CHANGELOG.md.j2"

[tool.commitizen.customize]
change_type_map = {"feat" = "Feature", "fix" = "Bugfixes", "refactor" = "Code refactoring","perf" = "Performance improvements"}
change_type_order = ["BREAKING CHANGE", "New features", "Bug fixes", "Code refactoring", "Performance improvements"]

I browsed through the source code, and it has code to override the default settings if the above is found. However, when I run it via a Github workflow, the mapping isn't applied.

Workflow: bump.yml

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 generate changelog with commitizen"
    steps:
      - name: Check out
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
      - name: Create bump and changelog
        uses: commitizen-tools/commitizen-action@master
        with:
          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          changelog_increment_filename: body.md
          debug: true
      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          body_path: "body.md"
          tag_name: ${{ env.REVISION }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

How can I make this work?

Thanks!