Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

[Feature Request] Add command to generate only recent changelog changes #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jtpavlock opened this issue Jul 23, 2020 · 7 comments · Fixed by #359
Closed

[Feature Request] Add command to generate only recent changelog changes #225

jtpavlock opened this issue Jul 23, 2020 · 7 comments · Fixed by #359
Labels
type: feature A new enhacement proposal

Comments

@jtpavlock
Copy link
Contributor

jtpavlock commented Jul 23, 2020

Description

So a normal workflow would be to automatically release to GitHub after a new version tag is created. That part works, but there is no good way to include the recent changelog additions as the body paragraph of the GitHub release.

To release with github actions, you do something like

name: Release

on:
  push:
    tags:
      - "v*"

jobs:
  github_release:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Release to GitHub
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: Release ${{ github.ref }}
        body: |
        "my new changes here"
        draft: false
        prerelease: false

Currently, and please correct me if I'm wrong, there is no way to automatically fill "body" with the recent additions to the changelog

Possible Solution

Introduce an option to cz changelog that would allow to to generate the most recent version so you could say something like this:

    # so we can use it as the github release body
    - name: Store recent changelog changes
      run: |
        echo ::set-env name=CHANGELOG::$(cz changelog --dry-run --recent)

    - name: Release to GitHub
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: Release ${{ github.ref }}
        body: ${{ env.CHANGELOG }}
        draft: false
        prerelease: false
@Lee-W
Copy link
Member

Lee-W commented Jul 24, 2020

It looks like changelog_hook in Custom changelog generator. It might be more convenient if we could have an argument for it. I'm ok with this feature. @woile what do you think?

@woile
Copy link
Member

woile commented Jul 24, 2020

I think this can be achieved by using start-rev or incremental.

cz changelog --incremental --dry-run

or if you know the previous version:

cz changelog --dry-run --start-rev 0.1.0

Let me know if this covers your use case, or if it fails somewhere, I tried it locally and it seems to work.

@woile woile added enhancement type: feature A new enhacement proposal and removed enhancement labels Jul 24, 2020
@jtpavlock
Copy link
Contributor Author

jtpavlock commented Jul 24, 2020

cz changelog --incremental --dry-run

This will generate the changelog for the next version. I'm trying to get the changelog for the most recent version.

cz changelog --dry-run --start-rev 0.1.0

I don't think there's any way to programatically know the previous version. This would work, if --start-rev included the version passed, but I don't think that's the current behavior.

@jtpavlock
Copy link
Contributor Author

Thank you for tackling this, however I'm not sure the solution proposed in #359 fixes my issue.

The workflows for generating a github release are separate than those bumping the version since they have different run conditions. As you can see in my initial issue report, the release workflow would only run if it sees a new version tag. By this time, cz bump has already been run and there is no way to store the outputted changelog in between runs.

The solution to this feature request would require an option to the changelog command so that the workflow in my initial feature request could work.

@jtpavlock
Copy link
Contributor Author

Any chance this could be looked at again?

@woile
Copy link
Member

woile commented Jul 8, 2021

Would something like #399 be useful?

@jtpavlock
Copy link
Contributor Author

Would something like #399 be useful?

Yes, that looks like it would solve my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A new enhacement proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants