Git Product home page Git Product logo

Comments (6)

jacobolofsson avatar jacobolofsson commented on August 25, 2024 1

If anyone else finds this issue and were wondering, this is what I ended up with in the end:

name: Bump version

on:
  schedule:
    - cron: "0 0 * * 0"
  workflow_dispatch:

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
      - id: cz
        name: Create bump and changelog
        uses: commitizen-tools/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          push: false
      - name: Print Version
        run: echo "Bumped to version ${{ steps.cz.outputs.version }}"
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v4
        with:
          branch: bump-version-${{ steps.cz.outputs.version }}
          title: Bump version ${{ steps.cz.outputs.version }}
      # add tag manually, since the PR action does not push tags
      - run: |
          git push origin --tags

from commitizen-action.

woile avatar woile commented on August 25, 2024

Yes, you have to set this action to not push. And then use this other action to create the pr:
https://github.com/marketplace/actions/create-pull-request

I don't see any issues with this setup, it should work right away. Feel free to ask here if you need help.

from commitizen-action.

dauberson avatar dauberson commented on August 25, 2024

I am having the same issue/doubt, I created a temporary branch and trying to push the commitizen diffs, but it isn't working.

- name: Create temporary branch
  run: |
    git checkout -b create-pull-request/patch main
    git push origin create-pull-request/patch

- id: cz
  name: Bump and Changelog
  uses: commitizen-tools/commitizen-action@master
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    changelog_increment_filename: body.md

I'm getting this error:

Pushing to branch...
error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.

from commitizen-action.

woile avatar woile commented on August 25, 2024

I think it's a different issue if you are trying to push from this action, but it doesn't. And for that you will have to share the whole action. I cannot see how you have configured the on key. Or the checkout action.

And again, if what you want is this action not to push, you have to tell it not to push, which I don't see in the snippet, something like this:

- id: cz
  name: Bump and Changelog
  uses: commitizen-tools/commitizen-action@master
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    changelog_increment_filename: body.md
    push: false

from commitizen-action.

jacobolofsson avatar jacobolofsson commented on August 25, 2024

Thanks for the help! I was able to get something working with:

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
      - id: cz
        name: Create bump and changelog
        uses: commitizen-tools/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          push: false
      - name: Print Version
        run: echo "Bumped to version ${{ steps.cz.outputs.version }}"
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v4
        with:
          branch: bump-version-${{ steps.cz.outputs.version }}
          title: Bump version ${{ steps.cz.outputs.version }}

which works to create the bump commit, and automatically open a PR. However, the tag is lost somewhere on the way I think. Do I need to enable some setting to also get the tag pushed to the PR as well?

from commitizen-action.

woile avatar woile commented on August 25, 2024

The tag is there, you can probably add a step and do git tag and it will be displayed.
For your next step I think you'll have to ask the maintainers of the action peter-evans/create-pull-request.
I have never seen this behavior so I'm not sure we can help. If you are creating the PR under the same repository, then you can add a new step and just push the tag. If you are creating a PR from a fork... I'm not sure it's possible to make a PR with a tag in it.

I'm closing now, but feel free to continue in a discussion

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.