Git Product home page Git Product logo

commitizen-action's People

Contributors

actions-user avatar adam-grant-hendry avatar arunanshub avatar audricschiltknecht avatar bobcashstory avatar edgarrmondragon avatar github-actions[bot] avatar janw avatar karthick-sh avatar kurt-von-laven avatar lee-w avatar liblaf avatar mmatl avatar nbrugger-tgm avatar phoenix1480 avatar t145 avatar willdasilva avatar woile avatar wtfiscrq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

commitizen-action's Issues

Clarification on how the workflow updates changelog and version

Hi,

I've been trying to integrate the action into my project for a couple of days now and can't seem to get it to work. I've attached the workflow file below but if anyone could shed some light on what I'm missing it would be greatly appreciated. For context, here is the scenario:


  1. I create a new branch called wip/something-cool from themaster branch which is currently at v3.37.1.
  2. On the wip/something-cool branch I create these three "commits":
    • refactor: changed something to be cool
    • fix: made cool even more cool
    • docs: updates on cool stuff
  3. I create a PR that runs a few status checks and after they all pass, I squash and merge the commits fromwip/something-cool into master.
  4. The commitizen-action workflow is triggered via the push event on the master branch.

At this point, I was expecting the action to use the commits from wip/something-cool to amend the changelog and bump the version from v3.37.1 to v3.37.2. Instead, the workflow says there aren't any commits to bump:

cz --no-raise 21 bump --yes --changelog --check-consistency --changelog-to-stdout >body.md
bump: version 3.37.1 → 3.37.1
tag to create: v3.37.1

[NO_COMMITS_TO_BUMP]
The commits found are not eligible to be bumped
Repository: xDev-LLC/Dropship
Actor: msf-dev
Not pushing
Done.

I tried it again with a different PR but this time changing the merged branch name to something like fix: something cool which does bump the version; however, in the changelog, you only have the fix: something cool and lose the squashed commits information.


# .github/workflows/bumpversion.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 create changelog with commitizen"
    steps:
      - name: Check out
        uses: actions/checkout@v2
        with:
          token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
          fetch-depth: 0

      - name: Create bump and changelog
        uses: commitizen-tools/[email protected]
        with:
          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          changelog_increment_filename: body.md

Reporting a vulnerability

Hello!

I hope you are doing well!

We are a security research team. Our tool automatically detected a vulnerability in this repository. We want to disclose it responsibly. GitHub has a feature called Private vulnerability reporting, which enables security research to privately disclose a vulnerability. Unfortunately, it is not enabled for this repository.

Can you enable it, so that we can report it?

Thanks in advance!

PS: you can read about how to enable private vulnerability reporting here: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository

How to use pre_bump_hook scripts with this action

Hi all,

Question here:

I am interested in using this pre-bump-hooks built-in commitizen feature to update my repository documentation before create the tag and push the commit, like it is said in the site:

Useful when you need to generate documentation based on the new version. During execution of the script, some environment variables are available

It works pretty well in a local machine using the installed commitizen version (pip install -U commitizen) but, if I understood correctly, this action is a Docker Action, which means that it runs inside a pre-built docker image which does not contain the scripts that is referenced in my .cz.yaml configuration file, unless if I was able to mount a volume in this image containing my script, for instance (not sure if it is a regular approach in github actions - volume mount)

Is there any way to do it? Are you have some related issue in the roadmap?

Thanks in advance

Actor of pushing to branch should be configurable

Hi,

thanks for this action!
I think there is a problem when the PAT used in the token belongs to one user and the actual commit actor are different which causes errors during pushing of bump commit and tag.
So if the PAT in the workflow belongs to a bot user A and the actual commit happens from a human user B then if I understand correctly the url in entrypoint.sh will try to authenticate user B with token from A and this will cause a failure in pushing.

I think an input configuring the actual user in this url (defaulting to actor) should suffice. I can also create a PR for this if this solution makes sense!

Thanks!

[Bug] Semver rules & current branch

Hey! I noticed two bugs while setting up this action and testing it.

  • 1. The action fails while pushing due to fatal: couldn't find remote ref master
  • 2. Pre-Release generates invalid/wrong semver version
  1. I've the following step
      - name: Create bump and changelog
        uses: commitizen-tools/commitizen-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          changelog_increment_filename: body.md
          prerelease: ${{ steps.is_main.outputs.prerelease_type }}

and everything works expect the pushing. This is because the action tries to push to master, but I'm using main. Sadly I can't hard-code it, because I'm listening to multiple branches (for pre-release branches)

  1. While testing I've noticed it generates for a (beta) pre-release the following version 1.1.0b0 but it should be 1.1.0-beta(.0) instead (see semver rules)
    In their example for which version is lower and higher, they have the following Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.

I hope it's okay, that I've not split this issue in two, that's why I've created checkboxes.

Add option pass on NoCommitsFoundError

If you use a change type like ci:, build:, docs:, style: or chore:, it won't bump the version unless you add it to the bump_pattern and bump_map. You may not want to bump the version for these change types. I propose adding
an option to allow pass on NoCommitsFoundError. In the exit codes documentation, it throws an error code of 3 when no commits are found. An option to allow pass on no commits found will allow for simpler workflows. For example, if I update the docs or other change types that don't necessitate a release, with an option like allow_no_commits I won't have to put parsing around the commit message to not run. With the this option runs the risks of swallowing unintentional errors.

Incorrect Changelog behaviour?

I'm hoping to clarify the configuration/behaviour for the changelog parameter. Based on the README (where the default is listed as true) I'd assumed false would disable it. That appears not to be the case…?

I'm using commitizen-action and have set changelog to false:

      - uses: commitizen-tools/commitizen-action@master
        name: commitizen
        with:
          commitizen_version: v2.20.5
          changelog: false
          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

However, this ended up creating a CHANGELOG.md file. Looking at the output, I can see that it's somehow inferring the --changelog flag:

Commitizen version:
2.20.5
Configuring git user and email...
Git name: github-actions[bot]
Git email: github-actions[bot]@users.noreply.github.com
Running cz:    --changelog
bump: version 0.2.0 → 0.2.1
tag to create: 0.2.1
increment detected: PATCH

However, after changing the changelog value to "" (i.e. an empty string) instead of false, it behaves as expected as doesn't create the CHANGELOG.md file (and the above output simply lists Running cz:.)

Have I misinterpreted how the changelog value is supposed to be set?

Option for opening a PR instead of pushing directly to branch

Thanks for a great action & tool!

I have a repo set up with strict branch protection rules (that always requires a PR to main). It would be great if there was some option to push to a new branch, and then automatically open a PR to the target branch. (I envision having a workflow that run on a cron-schedule and opens a version bump PR once a day if there are new commits on main)

Maybe this is out of scope for this tool, and/or can be achieved by combining some existing actions? I'm still kinda new to GH actions, so I might be missing some obvious solutions as well

failed to push refs in git-lfs enabled repo

Hi, thanks a lot for this action!
I'm trying to use it in my project, that has git-lfs enabled.
When trying to push the new commit, it gives me the following:

2021-01-06T18:12:19.0740861Z Pushing to branch...
2021-01-06T18:12:19.7076309Z 
2021-01-06T18:12:19.7078859Z This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.
2021-01-06T18:12:19.7079533Z 
2021-01-06T18:12:19.7093920Z error: failed to push some refs to '***github.com/sanzoghenzo/wsl-tools.git'

I'm not sure if this is a git-lfs problem, of it's only a warning and the problem is unrelated.
bumping manually from my computer (where I have git-lfs) works.

Here's the workflow used, and here's the last execution with the log.

Should I enable lfs? If so, how?

Thanks for your help

Git output in the changelog increment file

The action writes the output to the changelog increment file if the changelog_increment_filename input is applied. However, the final file includes the output from Git, e.g. (taken from the latest release):

[master https://github.com/commitizen-tools/commitizen-action/commit/1f11eb222996406681d2bfa1eb3d997eca46557c] bump: version 0.20.0 → 0.21.0
2 files changed, 8 insertions(+), 1 deletion(-)

Is that actually needed? I think having here a link to the previous-current release comparison would be more useful.

I guess this will require some extra processing of the bump output involving removing the last two lines.

Action does not find a specified file in version_files

Scenario

  • A repository holding a python project, with the following structure:
repo-root/
├── .cz.toml
├── .gitignore
├── src
│   ├── pypackage
│   │   ├── __init__.py
│   │   └── ...
│   ├── pyproject.toml
│   └── requirements.txt
└── test
    └── ...
  • The contents of .cz.toml being:
[tool.commitizen]
version = "0.0.5"
tag_format = "v$major.$minor.$patch"
version_scheme = "semver"
version_provider = "pep621"
major_version_zero = true
update_changelog_on_bump = false
version_files = [
    "src/pyproject.toml:version",
]
  • The invocation of this action
- id: cz
  name: Commitizen | Bump
  uses: commitizen-tools/commitizen-action@master
  with:
    push: false
    commit: false
    increment: PATCH
    github_token: ${{ secrets.MYTOKEN }}
    changelog: false

Expected outcome

Running the cz job step should succeed, bumping the version on .cz.toml and src/pyproject.toml.

Actual outcome (failure)

The log of execution is:

Run commitizen-tools/commitizen-action@master
/usr/local/bin/docker run --name ae4c464ff0919c3743e7818646fbeb9524d7_a3ecf2 --label 43ae4c --workdir /github/workspace --rm -e "INPUT_PUSH" -e "INPUT_COMMIT" -e "INPUT_INCREMENT" -e "INPUT_GITHUB_TOKEN" -e "INPUT_CHANGELOG" -e "INPUT_DEBUG" -e "INPUT_DRY_RUN" -e "INPUT_MERGE" -e "INPUT_PRERELEASE" -e "INPUT_DEVRELEASE" -e "INPUT_LOCAL_VERSION" -e "INPUT_REPOSITORY" -e "INPUT_BRANCH" -e "INPUT_EXTRA_REQUIREMENTS" -e "INPUT_CHANGELOG_INCREMENT_FILENAME" -e "INPUT_GIT_REDIRECT_STDERR" -e "INPUT_GIT_NAME" -e "INPUT_GIT_EMAIL" -e "INPUT_COMMITIZEN_VERSION" -e "INPUT_NO_RAISE" -e "INPUT_CHECK_CONSISTENCY" -e "INPUT_GPG_SIGN" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_EVENT_PATH" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "GITHUB_ACTION" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/runner/_work/_temp/_github_home":"/github/home" -v "/runner/_work/_temp/_github_workflow":"/github/workflow" -v "/runner/_work/_temp/_runner_file_commands":"/github/file_commands" -v "/runner/_work/myrepo/myrepo":"/github/workspace" 43ae4c:464ff0919c3743e7818646fbeb9524d7
gpg (GnuPG) 2.4.4
libgcrypt 1.10.3
Copyright (C) 2024 g10 Code GmbH
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /github/home/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
git version 2.43.4
Configuring Git username, email, and pull behavior...
Git name: github-actions[bot]
Git email: github-actions[bot]@users.noreply.github.com
pip install commitizen
WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting commitizen
  Downloading commitizen-3.25.0-py3-none-any.whl (70 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.2/70.2 kB 11.6 MB/s eta 0:00:00
...
Successfully installed MarkupSafe-2.1.5 argcomplete-3.3.0 charset-normalizer-3.3.2 colorama-0.4.6 commitizen-3.25.0 decli-0.6.2 importlib_metadata-7.1.0 jinja2-3.1.4 packaging-24.0 prompt_toolkit-3.0.36 pyyaml-6.0.1 questionary-2.0.1 termcolor-2.4.0 tomlkit-0.12.5 wcwidth-0.2.13 zipp-3.18.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Notice:  A new release of pip is available: 23.0.1 -> 24.0
Notice:  To update, run: pip install --upgrade pip
Commitizen version: 3.25.0
Traceback (most recent call last):
  File "/usr/local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/commitizen/cli.py", line 607, in main
    args.func(conf, arguments)()
  File "/usr/local/lib/python3.10/site-packages/commitizen/commands/version.py", line 25, in __call__
    version = get_provider(self.config).get_version()
  File "/usr/local/lib/python3.10/site-packages/commitizen/providers/base_provider.py", line 79, in get_version
    document = tomlkit.parse(self.file.read_text())
  File "/usr/local/lib/python3.10/pathlib.py", line 1134, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/usr/local/lib/python3.10/pathlib.py", line 1119, in open
    return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: 'pyproject.toml'

gpg: signing failed: No secret key

I've followed the steps using crazy-max/ghaction-import-gpg as the documentation recommended.

However I'm having no luck getting the commitizen-action to sign the commits/tags etc.

name: Bump Version

on:
  push:
    branches:
      - main

jobs:
  build:
    if: "!startsWith(github.event.head_commit.message, 'bump:')"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
      - name: Import GPG key
        id: import_gpg
        uses: crazy-max/ghaction-import-gpg@v5
        with:
          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
          passphrase: ${{ secrets.GPG_PASSPHRASE }}
          trust_level: 5
          git_user_signingkey: true
          git_commit_gpgsign: true
          git_tag_gpgsign: true
          git_config_global: true
      - name: List keys
        run: |
          gpg --list-keys
          echo ${{ steps.import_gpg.outputs.fingerprint }}
          echo ${{ steps.import_gpg.outputs.keyid }}
          git config --global --list
      - name: Create bump and changelog
        uses: commitizen-tools/commitizen-action@master
        with:
          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          git_name: ${{ steps.import_gpg.outputs.name }}
          git_email: ${{ steps.import_gpg.outputs.email }}
          changelog_increment_filename: VERSION.md
          gpg_sign: false
          debug: true
      - name: Output REVISION
        run: |
          echo ${{ env.REVISION }}
      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          body_path: "VERSION.md"
          tag_name: "v${{ env.REVISION }}"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Commitizen version: 3.5.2
cz --debug --no-raise 21 bump --yes --gpg-sign --changelog --check-consistency
bump: version 0.0.2 → 0.0.3
tag to create: v0.0.3
increment detected: PATCH

[main 6aee056] bump: version 0.0.2 → 0.0.3
 1 file changed, 13 insertions(+)

error: gpg failed to sign the data:
gpg: directory '/github/home/.gnupg' created
gpg: skipped "brazarb <11[102](https://github.com/org/ClickUpTest/actions/runs/*******/jobs/*********#step:6:103)******+******@users.noreply.github.com>": No secret key
[GNUPG:] INV_SGNR 9 author <*******+******@users.noreply.github.com>
[GNUPG:] FAILURE sign 17
gpg: signing failed: No secret key

error: unable to sign the tag

Traceback (most recent call last):
  File "/usr/local/bin/cz", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/commitizen/cli.py", line 463, in main
    args.func(conf, vars(args))()
  File "/usr/local/lib/python3.8/site-packages/commitizen/commands/bump.py", line 351, in __call__
    raise BumpTagFailedError(c.err)
commitizen.exceptions.BumpTagFailedError: error: gpg failed to sign the data:
gpg: directory '/github/home/.gnupg' created
gpg: skipped "author <******+******@users.noreply.github.com>": No secret key
[GNUPG:] INV_SGNR 9 author <******+******@users.noreply.github.com>
[GNUPG:] FAILURE sign 17
gpg: signing failed: No secret key

error: unable to sign the tag

Checking git config --global --list matches the name, email and signing key.

Don't Merge Pull Requests

If this action is run on a pull_request event, it merges the pull request to the specified branch even if it has no commits to push. Not sure what the right way to handle that scenario is, but at least it shouldn't push if it hasn't made any commits. It's not advisable to run this action on pull_request, but it can be a difficult mistake to undo once it has happened. One way of checking whether there is anything to push would be to compare the project version before and after running cz bump. Another would be to use git diff --quiet <current_branch> origin/<current_branch>.

Is there a way of knowing if bump detected an increment?

I would like to programatically disable subsequent steps in a workflow if no increment is detected in this action (If cz bump detects no increment).

Does it make sense to add an output variable that states whether or not an increment was detected or is there a simpler way of approaching this?

check if commits are compliant

Hi,
I don't see a way to check if the commits are compliant with conventional commits.
I need to do this step before the starting of the the jobs inside the action.
Thanks a lot

Angelo

Quote Bash Variables

Most of the Bash variables in entrypoint.sh are unquoted, so they will not properly escape any shell characters with special meaning that may happen to be present in their contents, which can have highly unpredictable results. See SC2086.

Allow to provide Git config or disable it

Description

This action setups Git automatically for the user which is nice in most use-cases but decreases customisation in certain workflows.

For example, one might want to use a custom GitHub App's as the commiter, so he/her can add extra validations around it and more easily audit what workflows are doing what across multiple repositories.

Possible Solutions

  • Allow the user to pass git_name and git_email inputs or default to GitHub Action's ones
    or
  • Allow the user to pass a setup_git flag to toggle this feature and setup git before running the action

If this sounds a reasonable feature for you, I can create a PR adding it.

Thanks in advance!

Bump commit in detached HEAD state not being pushed to master branch

Hey there!

I have this action:

    - id: cz
      name: Create bump and changelog
      if: steps.tag-check.outputs.exists == 'false'
      uses: commitizen-tools/commitizen-action@master
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        push: true
        changelog: true
        commit: true
        branch: master
        no_raise: 21

I was expecting that the branch config would push it into the master branch.

But the commit is in "detached HEAD state", for what I understand.

Can anyone enlighten me?

Thanks!

Option to specify MANUAL_VERSION

Hi. As described in the cli cz bump MANUAL_VERSION, is it possible to specify the MANUAL_VERSION in the Github Action? If not, can the option be added? Thank you!

Running the action with changelog_increment_filename fails

Hi all,

excellent action, thank you.

However I'm having an issue when using the argument changelog_increment_filename, the action runs successfully if I remove the argument, but obviously no increment change log file is created for the softprops/action-gh-release action.

[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "v$version"
version_type = "semver"
version_provider = "scm"
update_changelog_on_bump = true
major_version_zero = true
name: Bump Version

on:
  push:
    branches:
      - main

jobs:
  build:
    if: "!startsWith(github.event.head_commit.message, 'bump:')"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
          fetch-depth: 0
      - name: Create bump and changelog
        uses: commitizen-tools/commitizen-action@master
        with:
          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          changelog_increment_filename: VERSION.md
      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          body_path: "VERSION.md"
          tag_name: ${{ env.REVISION }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Notice:  A new release of pip is available: 23.0.1 -> 23.1.2
Notice:  To update, run: pip install --upgrade pip
Commitizen version: 3.5.2
cz --no-raise 21 bump --yes --changelog --check-consistency --changelog-to-stdout >VERSION.md
bump: version 0.0.2 → 0.0.3
tag to create: v0.0.3
increment detected: PATCH

Done!
Repository: org/ClickUpTest
Actor: actor
Pushing to branch...
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.
##[debug]Docker Action run completed with exit code 128
##[debug]REVISION='0.0.3'
##[debug]Set output version = 0.0.3
##[debug]Finishing: Create bump and changelog

Replicating this locally with the command above.

cz --no-raise 21 bump --yes --changelog --check-consistency --changelog-to-stdout >VERSION.md

Updates the CHANGELOG.md, creates the tag and commits the file. It then it changes the VERSION.md file, but neither it stages it or commits it.

image

I tried using another action EndBug/add-and-commit@v9 to perform the commit, but the commitizen action still throws that error because it looks like it's performing a pull/rebase.

[Feature] `push` and or `commit` input

I think there are plenty of reasons why you do not want this action to commit or push the file, like adding the changelog to a github-release or posting the changelog into a comment in a PR or issue.

Proposed inputs

push: if false the commited changes wont be pushed (default: true)
commit: if false changes wont be commited (default: true)

this action is installing commitizen == 1.0.0 if the project pinned tomlkit dependency != 0.5.3

I want to point out, that the assertion/hope that a sane project puts deployment/dev dependencies into its production requirements (requirements.txt) cannot be hold: https://github.com/commitizen-tools/commitizen-action/blob/master/entrypoint.sh#L21-L23

IMHO commitizen should install plugins from a specific file, but must not use requirements.txt. Project dependencies must not suffer from or be twisted by tool dependencies.

Add `working-directory` argument

So we can run this action in a different subdirectory in case of larger/mono repositories:

      - name: Create bump and changelog
        uses: commitizen-tools/commitizen-action@master
        with:
          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
          working-directory: backend  <--

Bump failing after commitizen upgrade to 2.21.0

When commitizen was upgraded to 2.21.0, my job started to fail with No tag found to do an incremental changelog. Here are the logs from the workflow:

Run commitizen-tools/commitizen-action@master
  with:
    github_token: ***
    changelog_increment_filename: body.md
    branch: main
    commit: true
    push: true
    changelog: true
    git_name: github-actions[bot]
    git_email: github-actions[bot]@users.noreply.github.com

/usr/bin/docker run --name db2d75cd135537dca42949a8bba04dc640a1c_2a63e9 --label 7db2d7 --workdir /github/workspace --rm -e INPUT_GITHUB_TOKEN -e INPUT_CHANGELOG_INCREMENT_FILENAME -e INPUT_BRANCH -e INPUT_DRY_RUN -e INPUT_COMMIT -e INPUT_PUSH -e INPUT_PRERELEASE -e INPUT_CHANGELOG -e INPUT_REPOSITORY -e INPUT_EXTRA_REQUIREMENTS -e INPUT_GIT_NAME -e INPUT_GIT_EMAIL -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/dialexa-python-cookiecutter/dialexa-python-cookiecutter":"/github/workspace" 7db2d7:5cd135537dca42949a8bba04dc640a1c

Repository: datanrd/dialexa-python-cookiecutter
Actor: datanrd
Installing requirements...
WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting commitizen
  Downloading commitizen-2.21.0-py3-none-any.whl (44 kB)
Collecting termcolor<2.0,>=1.1
  Downloading termcolor-1.1.0.tar.gz (3.9 kB)
Collecting jinja2>=2.10.3
  Downloading Jinja2-3.0.3-py3-none-any.whl ([13](https://github.com/datanrd/dialexa-python-cookiecutter/runs/5259326201?check_suite_focus=true#step:4:13)3 kB)
Collecting pyyaml>=3.08
  Downloading PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (701 kB)
Collecting questionary<2.0.0,>=1.4.0
  Downloading questionary-1.10.0-py3-none-any.whl (31 kB)
Collecting decli<0.6.0,>=0.5.2
  Downloading decli-0.5.2-py3-none-any.whl (7.7 kB)
Collecting packaging<22,>=19
  Downloading packaging-21.3-py3-none-any.whl (40 kB)
Collecting colorama<0.5.0,>=0.4.1
  Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting typing-extensions<5.0.0,>=4.0.1
  Downloading typing_extensions-4.1.1-py3-none-any.whl (26 kB)
Collecting argcomplete<2.0.0,>=1.12.1
  Downloading argcomplete-1.12.3-py2.py3-none-any.whl (38 kB)
Collecting tomlkit<1.0.0,>=0.5.3
  Downloading tomlkit-0.10.0-py3-none-any.whl (33 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux20[14](https://github.com/datanrd/dialexa-python-cookiecutter/runs/5259326201?check_suite_focus=true#step:4:14)_x86_64.whl (25 kB)
Collecting pyparsing!=3.0.5,>=2.0.2
  Downloading pyparsing-3.0.7-py3-none-any.whl (98 kB)
Collecting prompt_toolkit<4.0,>=2.0
  Downloading prompt_toolkit-3.0.28-py3-none-any.whl (380 kB)
Collecting wcwidth
  Downloading wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Building wheels for collected packages: termcolor
  Building wheel for termcolor (setup.py): started
  Building wheel for termcolor (setup.py): finished with status 'done'
  Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4848 sha256=798398deb6ba012869b562e9e66ba52d214a099d0cf6132f1ff269d81104ce27
  Stored in directory: /tmp/pip-ephem-wheel-cache-5mm7a4mv/wheels/a0/[16](https://github.com/datanrd/dialexa-python-cookiecutter/runs/5259326201?check_suite_focus=true#step:4:16)/9c/5473df82468f958445479c59e784896fa24f4a5fc024b0f501
Successfully built termcolor
Installing collected packages: wcwidth, pyparsing, prompt-toolkit, MarkupSafe, typing-extensions, tomlkit, termcolor, questionary, pyyaml, packaging, jinja2, decli, colorama, argcomplete, commitizen
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Successfully installed MarkupSafe-2.1.0 argcomplete-1.12.3 colorama-0.4.4 commitizen-2.[21](https://github.com/datanrd/dialexa-python-cookiecutter/runs/5259326201?check_suite_focus=true#step:4:21).0 decli-0.5.2 jinja2-3.0.3 packaging-21.3 prompt-toolkit-3.0.28 pyparsing-3.0.7 pyyaml-6.0 questionary-1.10.0 termcolor-1.1.0 tomlkit-0.10.0 typing-extensions-4.1.1 wcwidth-0.2.5
WARNING: You are using pip version 21.2.4; however, version [22](https://github.com/datanrd/dialexa-python-cookiecutter/runs/5259326201?check_suite_focus=true#step:4:22).0.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Commitizen version:
2.21.0
Configuring git user and email...
Git name: github-actions[bot]
Git email: github-actions[bot]@users.noreply.github.com
Running cz:   --changelog 
bump: version 0.1.0 → 0.1.1
tag to create: 0.1.1
increment detected: PATCH

No tag found to do an incremental changelog

When running cz bump --yes --changelog locally it completes without error.

Bump failing after upgrade from 0.16.0 -> 0.16.1

After release 0.16.1 with the fix for git safe directories was added, the base image's python version was bumped as well and was not reflected in the changelog.

When using custom-made packages inside of the docker image, this version can cause breakage in pipelines.

Is making the python version of the action configurable a desireable feature?

`check_consistency` has no effect

Hello, new option check_consistency has no any effect and command still called with --check-consistency option

Example of github action call:

      - id: cz
        name: Bump version and changelog
        uses: commitizen-tools/commitizen-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          dry_run: false
          push: false
          merge: false
          check_consistency: false

cz command call was:

cz --no-raise 21 bump --yes --changelog --check-consistency

Generate Github release page

Description

The Github Action currently generates release only with the tag number information but nothing else.

Possible Solution

The Github Action could generate a detailed Github release page description with the contents of the changelog of that release through the release api endpoint

Additional context

Compare commitizen releases with python-semantic-release ones.

Some users use the Watch releases to get updated on the evolution of the different software, so it's a nice way to share with your users your progress.

Thanks!

Feature Request: Option To Automatically Update Major and Minor Version Tags

release-please-action's documentation describes how one can hand-roll an approach to automatically keeping vX and vX.Y (or simply X and X.Y in keeping with Commitizen's existing style) tags up to date with the latest corresponding patch version. GitHub Action's own official documentation recommends such a tagging procedure: "Using the specific major action version allows you to receive critical fixes and security patches while still maintaining compatibility. It also assures that your workflow should still work." It would be super convenient to offer an input that just does this automatically. Not sure if this issue would be better suited to the commitizen repo or here.

[BUG]: Unstaged Changes

I have a GitHub Workflow Action setup to use commitizen-tools/commitizen-action@latest

Although, I am getting an error:

error: cannot pull with rebase: You have unstaged changes.
error: Please commit or stash them.

I don't know how to fix this or to commit the changes to the branch. I can check the git status before the action, but it seems that it is happening in the action. I can set push: false and then the error goes away, since I am no longer pushing the changes to the branch, but then the version change bump doesnt update and I would have to manually do this every time, and the changelog wouldnt be updated in my repo.

Don't Create Merge Commits

Git outputs the following warning, because the Commitizen action runs git pull without first configuring it:

hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.

Since the Commitizen action pulls immediately before pushing, it will create a merge commit in the event that the remote branch was pushed to externally while the action was running. Some projects disallow merge commits, and if there are any conflicts that need to be resolved, the action will fail regardless of the branch reconciliation strategy. Hence, the most universally palatable option is to configure Git to rebase on pull so that it will still succeed without creating a merge commit if it's able to perform a non-interactive rebase. The twelve-line warning also distracts a bit from the more meaningful content in the logs, particularly since it's at the end where the most important log output is often found.

No tag found to do an incremental changelog

Hello, I am trying to set up the commitizen action on a private repo following the instructions on the documentation but am encountering a No tag found to do an incremental changelog error when the action runs.

I created a personal access token, but I'm not sure what permissions to give it. I also read the discussion on #19, and I tried different settings/configurations for my yaml file, but I didn't find anything that ended up resolving this issue.

I'm relatively new to GitHub Actions, so I may be missing something obvious. Any help would be appreciated!


Here's the log from the action:
Run commitizen-tools/commitizen-action@master
  with:
    github_token: ***
    changelog_increment_filename: body.md
    commit: true
    push: true
    merge: false
    changelog: true
    git_name: github-actions[bot]
    git_email: github-actions[bot]@users.noreply.github.com
    commitizen_version: latest
    no_raise: 21
    check_consistency: false
    gpg_sign: false
    debug: false
/usr/bin/docker run --name ed866eeb9729ce48d0491b9191560bfb0c4362_fcaa4f --label ed866e --workdir /github/workspace --rm -e "INPUT_GITHUB_TOKEN" -e "INPUT_CHANGELOG_INCREMENT_FILENAME" -e "INPUT_DRY_RUN" -e "INPUT_COMMIT" -e "INPUT_PUSH" -e "INPUT_MERGE" -e "INPUT_PRERELEASE" -e "INPUT_CHANGELOG" -e "INPUT_REPOSITORY" -e "INPUT_BRANCH" -e "INPUT_EXTRA_REQUIREMENTS" -e "INPUT_GIT_NAME" -e "INPUT_GIT_EMAIL" -e "INPUT_COMMITIZEN_VERSION" -e "INPUT_NO_RAISE" -e "INPUT_INCREMENT" -e "INPUT_CHECK_CONSISTENCY" -e "INPUT_GPG_SIGN" -e "INPUT_DEBUG" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/new-modeling-toolkit/new-modeling-toolkit":"/github/workspace" ed866e:eb9729ce48d0491b9191560bfb0c4362
gpg (GnuPG) 2.4.1
libgcrypt 1.10.2
Copyright (C) 2023 g10 Code GmbH
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /github/home/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
git version 2.40.1
Configuring Git username, email, and pull behavior...
Git name: github-actions[bot]
Git email: github-actions[bot]@users.noreply.github.com
pip install commitizen
WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting commitizen
  Downloading commitizen-3.2.2-py3-none-any.whl (55 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.2/55.2 KB 6.0 MB/s eta 0:00:00
Collecting charset-normalizer<4,>=2.1.0
  Downloading charset_normalizer-3.1.0-cp38-cp38-musllinux_1_1_x86_64.whl (191 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 191.5/191.5 KB 32.2 MB/s eta 0:00:00
Collecting tomlkit<1.0.0,>=0.5.3
  Downloading tomlkit-0.11.8-py3-none-any.whl (35 kB)
Collecting termcolor<3,>=1.1
  Downloading termcolor-2.3.0-py3-none-any.whl (6.9 kB)
Collecting jinja2>=2.10.3
  Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 KB 209.4 MB/s eta 0:00:00
Collecting packaging>=19
  Downloading packaging-23.1-py3-none-any.whl (48 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 KB 136.8 MB/s eta 0:00:00
Collecting colorama<0.5.0,>=0.4.1
  Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting importlib_metadata<7,>=4.13
  Downloading importlib_metadata-6.6.0-py3-none-any.whl (22 kB)
Collecting decli<0.7.0,>=0.6.0
  Downloading decli-0.6.0-py3-none-any.whl (7.9 kB)
Collecting pyyaml>=3.08
  Downloading PyYAML-6.0.tar.gz (124 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.0/125.0 KB 247.9 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting argcomplete<3.1,>=1.12.1
  Downloading argcomplete-3.0.8-py3-none-any.whl (40 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.0/40.0 KB 183.3 MB/s eta 0:00:00
Collecting questionary<2.0.0,>=1.4.0
  Downloading questionary-1.10.0-py3-none-any.whl (31 kB)
Collecting zipp>=0.5
  Downloading zipp-3.15.0-py3-none-any.whl (6.8 kB)
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_x86_64.whl (29 kB)
Collecting prompt_toolkit<4.0,>=2.0
  Downloading prompt_toolkit-3.0.38-py3-none-any.whl (385 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 385.8/385.8 KB 95.4 MB/s eta 0:00:00
Collecting wcwidth
  Downloading wcwidth-0.2.6-py2.py3-none-any.whl (29 kB)
Building wheels for collected packages: pyyaml
  Building wheel for pyyaml (pyproject.toml): started
  Building wheel for pyyaml (pyproject.toml): finished with status 'done'
  Created wheel for pyyaml: filename=PyYAML-6.0-cp38-cp38-linux_x86_64.whl size=45331 sha256=2fed7912ffbcfa16e308cd349f7921e9c0d15b7a0563619faaeacbe99713e968
  Stored in directory: /tmp/pip-ephem-wheel-cache-xaajhirb/wheels/52/84/66/50912fd7bf1639a31758e40bd4312602e104a8eca1e0da9645
Successfully built pyyaml
Installing collected packages: wcwidth, zipp, tomlkit, termcolor, pyyaml, prompt_toolkit, packaging, MarkupSafe, decli, colorama, charset-normalizer, argcomplete, questionary, jinja2, importlib_metadata, commitizen
Successfully installed MarkupSafe-2.1.3 argcomplete-3.0.8 charset-normalizer-3.1.0 colorama-0.4.6 commitizen-3.2.2 decli-0.6.0 importlib_metadata-6.6.0 jinja2-3.1.2 packaging-23.1 prompt_toolkit-3.0.38 pyyaml-6.0 questionary-1.10.0 termcolor-2.3.0 tomlkit-0.11.8 wcwidth-0.2.6 zipp-3.15.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 22.0.4; however, version 23.1.2 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Commitizen version: 3.2.2
cz --no-raise 21 bump --yes --changelog --check-consistency --changelog-to-stdout >body.md
bump: version 0.4.4 → 0.5.0
tag to create: 0.5.0
increment detected: MINOR

No tag found to do an incremental changelog
Here's my `bumpversion.yml` file:
name: Bump version

on:
  push:
    branches:
      - main

jobs:
  bump-version:
    runs-on: ubuntu-latest
    name: "Bump version and create changelog with commitizen"
    steps:
      - name: Check out
        uses: actions/checkout@v3
        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
      - name: Release
        uses: softprops/action-gh-release@v1
        with:
          body_path: "body.md"
          tag_name: ${{ env.REVISION }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Using commitizen-action with an older version of commitizen (v2.23.0) results in a failure

When I use the commitizen-action, it fails with a cz: error: invalid choice: '21' (choose from 'init', 'commit', 'c', 'ls', 'example', 'info', 'schema', 'bump', 'changelog', 'ch', 'check', 'version') for commitizen v2.23.0.

Github actions config

      - name: Create bump and changelog
        id: cz
        uses: commitizen-tools/commitizen-action@master
        with:
          github_token: ${{ secrets.G_ACCESS_TOKEN }}
          branch: ${{ github.ref }}
          commitizen_version: v2.23.0
      - name: Print Version
        run: echo "Bumped to version ${{ steps.cz.outputs.version }}"

I also use a git pre-commit hook that looks like this

  - repo: https://github.com/commitizen-tools/commitizen
    rev: v2.23.0
    hooks:
      - id: commitizen
        stages: [commit-msg]

The pre-commit check works as expected but when the code runs in GA, it fails with the above error. I've also attached a screenshot
Screenshot 2022-07-05 at 13 00 08

New version isn't available as an output

Currently the newly created version is only available in the (undocumented) REVISION env variable.

Having the version as an environment variable is useful in simple cases but if you're using commitizen-action multiple times (i.e. different workspaces) or have any other step that sets that env var, it gets overwritten.

It can be more useful if the new version is available as an output of the step (i.e.: version), so it could be used like this:

- id: cz
  uses: commitizen-tools/commitizen-action@master
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
     
- run: |
    echo "The new version is ${{ steps.cz.outputs.version }}"

Additionally, I don't think the REVISION env variable should be removed for backwards compatibility, but should be documented in the README, so it's easier for new people to know about it without having to look at the source code.

Any thoughts?

Container error `fatal: --local can only be used inside a git repository`

Description
One of my workflows based on commitizen-action is now returning the following error:
image

It used to work properly and the yaml configuration file for the workflow was not subjected to changes when the issue occurred.

I have already tested that the error is raised for both [email protected] and [email protected].

The only step before commitizen-tools/[email protected] is actions/checkout@v3.

References
A similar issue is reported in peter-evans/create-pull-request#1170 and actions/checkout#760.

Docker image update
I've noticed that the image python:3.8 on DockerHub (used by the Dockerfile) was updated just before the first failure of the above-mentioned workflow.
According to the first reference, this issue may be related to Git version: a building process based on different images may explain why the workflow was successful and then failed in two consequent runs, with no configuration changes (and within a few hours of each other).

Pre-Bump Scripts do not have access to packages installed before using `commitizen-tools/commitizen-action`

Background

I have a closed-sample project where I make use of commitizen-action to handle versioning and changelog generation. I make use of .cz.toml's pre_bump_hooks configuration to add shell scripts which should be executed before version bump commit. The idea was to run a couple of cleanups based on the version information.

However, this fails as some external required packages are not made available to the scripts although they were installed in previous steps before commitizen-tools/commitizen-action is used.

Example

release.yml

 tag-and-bump:
    if: ${{ github.ref == 'refs/heads/main' && !startsWith(github.event.head_commit.message, 'bump:') }}
    needs: install-and-test
    runs-on: ubuntu-latest
    name: "Bump version and create changelog with commitizen"
    steps:
      - name: Check out
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          token: "${{ secrets.GITHUB_TOKEN }}"
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
            node-version: 16
      - name: Install packages
        run: yarn install --immutable
      - id: cz
        name: Bump package
        uses: commitizen-tools/commitizen-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
      - name: Print Version
        run: echo "Bumped to version ${{ steps.cz.outputs.version }}"

.cz.toml

pre_bump_hooks = [
  "scripts/pre-bump-script.sh"
]

scripts/pre-bump-scripts.sh

node -v

The script above fails with a command node not found

read new tag in following steps

is there a way to read the new tag when a changelog+bump are created in a following step?
I tried, but the repo is always the origina, and I don't see the modification.
Thanks a lot
Angelo

[FEAT]: 🎉 Add Support for GPG Signing

Currently, this action doesn't support gpg signing commits and tags. This could be added simply by modifying the entrypoint.sh script to accept a gpg passphrase and key that have been added as SECRETS to the repo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.