Skip to content

Current release changelog with merged pre-release changelog #687

@Apkawa

Description

@Apkawa
Contributor

Description

in my case, in gh-actions manually called cz ch like this, as example:

cz changelog --dry-run 0.2.0a2 > CHANGELOG.txt

and use as body for gh-release .

Example:

$ git tag
v0.1.0  
v0.2.0-a0
v0.2.0-a1
v0.2.0-a2

for the prerelease case, I use the current tag, like "0.2.0a2", that's fine.

but for release after all pre-releases i need to collect all commits between releases message like 0.2.0a0..0.2.0

at the moment it looks like this

$ cz ch 0.2.0a0..0.2.0 --dry-run
## v0.2.0 (2023-03-13)

### Fix

- foo fix 3

## v0.2.0b0 (2023-03-13)

## v0.2.0a1 (2023-03-13)

### Fix

- some fix

## v0.2.0a0 (2023-03-13)

### Feat

- super feature

## v0.1.0 (2023-03-13)

Possible Solution

I'm thinking about adding a flag for the merged prerelease commit in one release.
For example, --merge-prerelease

I want something like this:

$ cz ch 0.2.0a0..0.2.0 --dry-run  --merge-prerelease

## v0.2.0 (2023-03-13)

### Fix

- foo fix 3
- some fix

### Feat

- super feature

In the case of a multi-release range 0.1.0..0.3.0, the output would be:

$ cz ch 0.1.0..0.3.0 --dry-run  --merge-prerelease

## v0.3.0 (2023-03-13)

### Fix

- foo fix 3
- some fix

### Feat

- super feature

## v0.2.0 (2023-03-13)

### Feat

- feature

## v0.1.0 (2023-03-13)

### Feat

- feature foo

Additional context

This feature useful for gh-actions for me

      - name: Check version
        uses: apkawa/gh-action-semver-check@master
        id: version
      - name: Generate Changelog
        run: |
          cz changelog --dry-run ${{ steps.version.outputs.full_with_prefix }}a0..${{ steps.version.outputs.full_with_prefix }}  > ${{ github.workspace }}-CHANGELOG.txt

      - name: Publish archives and packages
        uses: softprops/action-gh-release@v1
        if: ${{ !github.event.schedule && startsWith(github.ref, 'refs/tags') }}
        with:
          draft: true
          prerelease: ${{ needs.version.outputs.prerelease }}
          body_path: ${{ github.workspace }}-CHANGELOG.txt

In addition, you may need a special syntax for the range
Instead of 0.2.0a0..0.2.0 there will be, for example, ~0.2.0. This will make things easier

Additional context

#364

Activity

Apkawa

Apkawa commented on Mar 13, 2023

@Apkawa
ContributorAuthor

What do you think about this? I'm thinking of making a pull request with this feature.

woile

woile commented on Mar 18, 2023

@woile
Member

I think is a good idea. One question though: do we want to merge-prereleases, or skip empty ones? What do you think would make more sense?

Apkawa

Apkawa commented on Mar 18, 2023

@Apkawa
ContributorAuthor

I think maybe separate flags

  1. skips empty prereleases, --skip-empty-prerelease , rest of logic as usual.
  2. collects all changes from prereleases to release, prereleases are not included in the log - --merge-prerelease. which is what I wrote above.
woile

woile commented on Apr 28, 2023

@woile
Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Apkawa@woile

        Issue actions

          Current release changelog with merged pre-release changelog · Issue #687 · commitizen-tools/commitizen