ietf-tools / semver-action

GitHub Action to calculate the next release version based on conventional commits
BSD 3-Clause "New" or "Revised" License
56 stars 22 forks source link

Add changelog building and output #3

Closed HRADigital closed 1 year ago

HRADigital commented 2 years ago

Hi @NGPixel ,

I didn't add the Changelog configuration inputs to the main table, due to configuration issues. Maybe you can do it better than I can. ... I've added the information below, though.

Icons and section titles are editable via inputs. If titles are set blank (empty string), section won't be rendered. Same with Contributor's section.

If Contributor's detailed information can be retrieved, an User handler with a link to the contributor's page will be rendered. Otherwise, just the name. These won't be duplicated (several commits by same author).

This will produce the result in the release note's body, as below: image

Thanks.

NGPixel commented 2 years ago

This is adding a lot of code which frankly isn't the goal of this action...

It's also mixing semver types (major, minor, patch) and commit types (new features, bug fixes, etc.) which are completely unrelated when it comes to generating a changelog. For example, you bundle docs, fix and style in a "Other Changes" section, which isn't really useful. Each type should have their own section, irrespective of whether they cause a major, minor or patch bump.

This is duplicating the https://github.com/Requarks/changelog-action action which already handles all of this.

Like I mentioned in the issue you opened on that repo, the intended workflow is:

Full example, specifically for using as release notes body:

      - name: Checkout Code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Get Next Version
        id: semver
        uses: ietf-tools/semver-action@v1
        with:
          token: ${{ github.token }}
          branch: main

      - name: Create Draft Release
        uses: ncipollo/release-action@v1
        with:
          prerelease: true
          draft: false
          commit: ${{ github.sha }}
          tag: ${{ steps.semver.outputs.next }}
          name: ${{ steps.semver.outputs.next }}
          body: '*pending*'
          token: ${{ github.token }}

      - name: Generate CHANGELOG
        id: changelog
        uses: requarks/changelog-action@v1
        with:
          token: ${{ github.token }}
          tag: ${{ steps.semver.outputs.next }}
          writeToFile: false

      - name: Finalize Release
        uses: ncipollo/release-action@v1
        with:
          allowUpdates: true
          draft: false
          tag: ${{ steps.semver.outputs.next }}
          name: ${{ steps.semver.outputs.next }}
          body: ${{ steps.changelog.outputs.changes }}
          token: ${{ github.token }}

This PR tries to do too much, which results in being less flexible than using the 2 actions above for their actual purposes.

As for the contributors bit in the footer, this is already handled natively by GitHub when using plain @user in a release body. Setting writeToFile: false in the changelog-action will generate @user mentions without the link so that they are parsed correctly by GitHub and a Contributors section will appear automatically in the release footer. e.g.:

image
HRADigital commented 2 years ago

No worries.

The purpose of this PR, would be to process the changelog, based on same configuration, and make it available in case of necessity. Could still be ignored, and workflow could be as you described.

Nonetheless, it's up to you to make the decision if it's worth it. If not, all is good.

Thanks.