Git Product home page Git Product logo

Comments (9)

woile avatar woile commented on September 22, 2024 1

You can have a step which installs commitizen with pip install commitizen, then run something like:

cz bump --git-output-to-stderr --dry-run | grep 'tag to create:' | grep -Eo '[0-9].+' > CZ_NEXT_VERSION
cat CZ_NEXT_VERSION

Or directly into a github action variable:

- name: Setup python
   uses: actions/setup-python@v4
   with:
      python-version: '3.x'
- run: pip install -U commitizen
- name: Next version
   id: getnextversion
   run: |
      export NEXT_VERSION=$(cz bump --git-output-to-stderr --dry-run | grep 'tag to create:' | grep -Eo '[0-9].+')
      echo "VERSION=$NEXT_VERSION" >> $GITHUB_OUTPUT
- name: Your NODEJS script
  env:
    CZ_PRE_NEW_VERSION: ${{ steps.getversion.outputs.VERSION }}
  
# HERE the commitizen action

Note: I'm on a MAC so the grep flags might be different

I believe any change done in git will be picked up by commitizen and commit them in the bump commit. If that's not the case, try doing git add <files you changed>, at that point cz bump will definitely pick them up for the cz bump commit generated.

from commitizen-action.

elcharitas avatar elcharitas commented on September 22, 2024 1

I'm closing this since my issue has been addressed already by @woile.
Thanks for the help

from commitizen-action.

woile avatar woile commented on September 22, 2024

Interesting, I'm not sure how to solve this issue. The thing is that the action runs on its own docker image.

from commitizen-action.

elcharitas avatar elcharitas commented on September 22, 2024

Interesting, I'm not sure how to solve this issue. The thing is that the action runs on its own docker image.

That would explain it.

So far, a fix I have found is to install the required packages within the same script however, the workflow takes wayy too long when I do this.

from commitizen-action.

woile avatar woile commented on September 22, 2024

Is it a possibility for you to re-write it in python or with coreutils? That's why I'm not a big fan pre_bump_hooks from commitizen.

from commitizen-action.

elcharitas avatar elcharitas commented on September 22, 2024

Is it a possibility for you to re-write it in python or with coreutils? That's why I'm not a big fan pre_bump_hooks from commitizen.

Unfortunately, the scripts aren't portable to python due to tight dependence on the packages.
Is there an alternative to using pre_bump_hooks you can recommend?

from commitizen-action.

woile avatar woile commented on September 22, 2024

What is your script doing? I'd consider if the step can be done outside commitizen. Which variables do you use from: https://commitizen-tools.github.io/commitizen/bump/#pre_bump_hooks

from commitizen-action.

elcharitas avatar elcharitas commented on September 22, 2024

Which variables do you use from: https://commitizen-tools.github.io/commitizen/bump/#pre_bump_hooks

I only make use of CZ_PRE_NEW_VERSION.

I'd consider if the step can be done outside commitizen.

Thanks for this, I can already see possible ways I can handle the scripts outside commitizen. The only downside is I'd have a chore: cleanup after bump commit after each version bump. But I should be able to live with that 😅

from commitizen-action.

elcharitas avatar elcharitas commented on September 22, 2024

You can have a step which installs commitizen with pip install commitizen, then run something like....

Thanks @woile I'm going to give this a try and let you know how it goes

from commitizen-action.

Related Issues (20)

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.