Git Product home page Git Product logo

changelog-action's Introduction

Changelog from Conventional Commits - Github Action

This GitHub Action automatically generates a changelog based on all the Conventional Commits between the latest tag and the previous tag, or beween 2 specific tags.

Features

  • Generates the CHANGELOG changes in Markdown format
  • Turns PR ids into links and add the PR author.
  • Prepends a shortened commit SHA ID to the commit for quick access.
  • BREAKING CHANGE notes are added to the top of the changelog version along with the related commit.
  • Exports changelog to a variable that can used in a subsequent step to create a release changelog.
  • Automatically injects the changes into the CHANGELOG.md file or creates it if it doesn't exist yet. (optional)
  • Will not mess up with any header or instructions you already have at the top of your CHANGELOG.md.
  • Will not add duplicate version changes if it already exists in the CHANGELOG.md file.
  • Optionally exclude types from the CHANGELOG. (default: build,docs,other,style)

Example Workflows

Using the latest tag

name: Deploy

on:
  push:
    tags:
      - v[0-9]+.[0-9]+.[0-9]+

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Update CHANGELOG
        id: changelog
        uses: requarks/changelog-action@v1
        with:
          token: ${{ github.token }}
          tag: ${{ github.ref_name }}

      - name: Create Release
        uses: ncipollo/[email protected]
        with:
          allowUpdates: true
          draft: false
          makeLatest: true
          name: ${{ github.ref_name }}
          body: ${{ steps.changelog.outputs.changes }}
          token: ${{ github.token }}

      - name: Commit CHANGELOG.md
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          branch: main
          commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
          file_pattern: CHANGELOG.md

Using a specific tag range

name: Deploy

on:
  push:
    tags:
      - v[0-9]+.[0-9]+.[0-9]+

jobs:
  deploy:
    runs-on: ubuntu-latest

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

      - name: Get previous tag
        id: previousTag
        run: |
          name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)
          echo "previousTag: $name"
          echo "previousTag=$name" >> $GITHUB_ENV

      - name: Update CHANGELOG
        id: changelog
        uses: requarks/changelog-action@v1
        with:
          token: ${{ github.token }}
          fromTag: ${{ github.ref_name }}
          toTag: ${{ env.previousTag }}
          writeToFile: false

      - name: Create Release
        uses: ncipollo/[email protected]
        with:
          allowUpdates: true
          draft: true
          makeLatest: true
          name: ${{ github.ref_name }}
          body: ${{ steps.changelog.outputs.changes }}
          token: ${{ secrets.GITHUB_TOKEN }}

Inputs

Field Description Required Default
token Your GitHub token (e.g. ${{ github.token }})
tag The latest tag which triggered the job. (e.g. ${{ github.ref_name }})
(unless using fromTag and toTag)
fromTag The tag from which the changelog is to be determined (latest)
(unless using tag)
toTag The tag up to which the changelog is to be determined (oldest)
(unless using tag)
excludeTypes A comma-separated list of commit types you want to exclude from the changelog (e.g. doc,chore,perf) build,docs,other,style
excludeScopes A comma-separated list of commit scopes you want to include in the changelog (e.g. dev,release)
restrictToTypes A comma-separated list of commit types you want to restrict to for the changelog (e.g. feat,fix,refactor). Overrides excludeTypes if defined.
writeToFile Should CHANGELOG.md be updated with latest changelog true
changelogFilePath The CHANGELOG.md file path when writeToFile is true CHANGELOG.md
includeRefIssues Should the changelog include the issues referenced for each PR. true
useGitmojis Should type headers be prepended with their related gitmoji true
includeInvalidCommits Whether to include commits that don't respect the Conventional Commits format false
reverseOrder List commits in reverse order (from newer to older) instead of the default (older to newer). false

Outputs

Field Description
changes Generated CHANGELOG changes for the latest tag, without the version / date header (for use in GitHub Releases).

⚠️ Important ⚠️

You must already have 2 tags in your repository (1 previous tag + the current latest tag triggering the job). The job will exit with an error if it can't find the previous tag!

changelog-action's People

Contributors

anden-dev avatar cupofme avatar kiyoon avatar ngpixel avatar sitepark-veltrup avatar sjpalf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

changelog-action's Issues

BUG: It seems no supports for post tag

Run requarks/changelog-action@v1
Using input tag: v0.3.0-post.1
Error: Provided tag doesn't match latest tag v0.3.0-post.1.

My workflow is ok at other times, but failed when tag name is v0.3.0-post.1, is that unsupported for -post tag or some mistakes causes by myself?

Here is a part of my workflow file:

- name: Generate Changelog
  id: changelog
  uses: requarks/changelog-action@v1
  with:
    token: ${{ github.token }}
    tag: ${{ github.ref_name }}
    includeInvalidCommits: true
    changelogFilePath: CHANGELOG.md
    writeToFile: true
    useGitmojis: false

Failing to query related issues

Hi,
For some reason I'm not able to query the related issues, any idea what might be the issue?
I have the idea I'm missing something stupid (quite new to github actions).

  • Initially I thought that it was a permissions issue, so I gave full permissions using write-all but no luck
  • The new release gets created with the correct tag, but the release changelog is empty (because it can't find any issues I assume)
  • I trigger the action manually for testing purposes.

Any pointers or tips are highly appreciated! 🙏

Action:


name: Create SemVer Release with Conventional Commits

on:
  workflow_dispatch:

permissions: write-all


jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

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

      - name: Create Release
        uses: ncipollo/[email protected]
        with:
          allowUpdates: true
          draft: false
          makeLatest: true
          tag: ${{ steps.semver.outputs.next }}
          name: ${{ steps.semver.outputs.next }}
          body: Changelog Contents
          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: Commit CHANGELOG.md
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          branch: master
          commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
          file_pattern: CHANGELOG.md

Output:

Querying related issues for PR 1...
Warning: Failed to query issues related to PR 1. Skipping.
Querying related issues for PR 2...
Warning: Failed to query issues related to PR 2. Skipping.

related PRs is different when writing to a file

In this place, where it collects the PRs from the subject line to write to the changelog file,

https://github.com/requarks/changelog-action/blob/main/index.js#L36

it will collect the PRS but NOT the rightmost (last) one from the subject line and the function buildSubject will return all but the last one.

A few lines down, when it is not writing to the changelog file, it collects all of the PRs in the subject line and returns all of them.

The PRs that are returned are used to build the "related issues" section(s).

Is it ignoring the last PR on the subject line when not writing on purpose or is it a mistake.

I am adapting your code with some modifications for our use and saw this when writing some tests and noticed this.

2nd Question:

The code in this line iterates over the PR refs in the subject line

https://github.com/requarks/changelog-action/blob/main/index.js#L42

but it is in an "else" clause that only runs if there are no PRs. So its equivalent to saying "output = subject"

It looks to me like you could rewrite that line (and remove the next lines) since it will never run. Am I missing something?

PR not detected

I notice that in your latest version, referenced PR's are supposed to be linked in the changelog messages where they exist.
Its not working for me.
when I click on the sha link I get taken to a diff page where I can clearly see the PR ref in the corner (eg: main (#16) ), so it does exist.
I'm wondering why my messages are of the format [e0d6403] - my message (commit by @someuser) and not including the PR ref?

I'm triggering the build:

on:
  create:

jobs:
   myjob:
    if: (contains(github.ref, '/tags/v'))
    ...
        id: changelog
        uses: requarks/changelog-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          fromTag: ${{ github.ref_name }}
          toTag: ${{ env.previousTag }}
          excludeTypes: ""
          writeToFile: false

Support `sha` as an alternative of `tag` input

Hello,

In a need to create only draft releases (without existing tag, as it will be created after publishing it), I would like to ask if it is possible to support given sha instead of only tags.

It would be possible by changing

 const tagsRaw = await gh.graphql(`
      query lastTags ($owner: String!, $repo: String!) {
        repository (owner: $owner, name: $repo) {
          refs(first: 2, refPrefix: "refs/tags/", orderBy: { field: TAG_COMMIT_DATE, direction: DESC }) {

using after and refPrefix conditionally

Provided tag doesn't match latest tag

I'm trying to set up automatic releases for my project, but I keep getting the error that Provided tag doesn't match latest tag, which I can't make sense of.
I'm currently using the same actions as the example in the README, but I've tried a bunch of variants already.

TypeError: core.setWarn is not a function

I am receiving an error while trying to test the action:

(node:1584) UnhandledPromiseRejectionWarning: TypeError: core.setWarn is not a function
    at main (/home/runner/work/_actions/Requarks/changelog-action/v1.3.1/dist/index.js:26894:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1584) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:[15](https://github.com/area28technologies/gh-actions-test/runs/6321575423?check_suite_focus=true#step:3:15)84) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Suggestion: Removal of Older Changelog Entries

Hi,

I have a changelog with entries from 0.0.1 to 0.1.5, the entries older than 0.5 are of no interest to me anymore and they can be removed from the changelog.

Would it be possible in this GitHub Action to support a max-range of changelog entries...or would that be better as a separate GitHub action?

The idea would be to cull/trim the bottom of the changelog a certain range/number of entries

Kind Regards

Chris

More commits than expected missing from changelog

I'm currently trying to figure out why for this project I get this release:

image

Although i the Git history I have:

$ git log --oneline 1.0.2 --not 1.0.1 | grep -vE "(build|docs|other|style)"
8deff4b56 WIP
1c804825d WIP
bcd24bda2 refactor(GitHub): Use the more common `github.token`
da42b9396 test(SpmFunTest): Update expected test results
293ebc435 feat(migrate): Add an option to convert NuGet IDs to the namespace format
dc32462e4 refactor(commands): Move configuration migration to a dedicated command
7d5b27952 refactor(package-curation-providers): Make `toCurationPath()` public
af1cbfc19 deps: update dependency com.github.jmongard.git-semver-plugin to v0.6.4
f6d9972bb deps: update dependency clsx to v2
dc6d4a990 deps: update dependency dev.adamko.dokkatoo:dokkatoo-plugin to v2
10fd8a789 deps: update actions/checkout action to v4
13efe5d48 ci: Exclude a URL link in Markdown from the link check
269e00d61 ci: Update reuse configuration for Docusaurus
b3cf8b807 deps: Update the native-gradle-plugin to version 0.9.27
be7ded29b chore(Gradle): Remove forcing the OkHttp version
924dd15b8 chore(batect): Remove the telemetry setting
1f37f99cd deps: update batect to v0.85.0
42b06ae1e revert(codecov): Go back to action v3 from v4
6cc2f5f8f deps: update graphqlplugin to v6.5.6

In understand that the "WIP" commits are missing because includeInvalidCommits is false by default, but why are the "deps", "ci" and "revert" commits missing as well with the default options as excludeTypes defaults to build,docs,other,style only?

Tag range to create changelog

In my case I would like to create changelogs not only for the last release but also for hotfixes further back in time.

%%{init: { 'gitGraph': {'showCommitLabel': false}} }%%
    gitGraph
       commit tag:"1.0.0"
       commit tag:"1.1.0"
       branch hotfix/1.1.x order:2
       checkout main
       commit tag:"..."
       commit tag:"2.0.0"
       commit tag:"2.1.0"
       branch hotfix/2.1.x order:1
       commit tag:"2.1.1"
       commit tag:"2.1.2"
       commit tag:"..."
       checkout hotfix/1.1.x
       commit tag:"1.1.1"
       commit tag:"1.1.2"
       commit tag:"..."
       checkout main
       commit tag:"..."
Loading

Here it would help me if instead of a tag, I could specify a range over which the changelog is generated.

I have created a fork for this purpose.

I still determine the necessary tag area for me about an extra script.

I use it like this:

name: Create GitHub Release Draft

on:
  push:
    tags:
      - [0-9]+.[0-9]+.[0-9]+

jobs:
  release-draft-with-changelog:
    runs-on: ubuntu-latest

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

      - name: Get previous tag
        id: previousTag
        run: |
          name=$(git --no-pager tag --sort=creatordate --merged ${{ github.ref_name }} | tail -2 | head -1)
          echo "previousTag: $name"
          echo "::set-output name=name::$name"

      - name: Update CHANGELOG
        id: changelog
        uses: sitepark-com/changelog-action@main
        with:
          token: ${{ github.token }}
          fromTag: ${{ github.ref_name }}
          toTag: ${{ steps.previousTag.outputs.name }}

      - name: Create Release
        uses: ncipollo/release-action@v1
        with:
          allowUpdates: true
          draft: true
          name: ${{ github.ref_name }}
          body: ${{ steps.changelog.outputs.changes }}
          token: ${{ secrets.GITHUB_TOKEN }}

But it would be more elegant if the previousTag would be determined in the changelog action. I haven't found a way to do this using the graphql query in the JavaScript.

Would this be a feature that could be merged?

Error: Internal server error occurred while resolving "actions/checkout@v2"

Hello, Sorry about my question, I am learning github Action, but I need help:

I am have a problem to create a changelog on my project.

the message is:

Error: Internal server error occurred while resolving "actions/checkout@v2". Internal server error occurred while resolving "actions/create-release@latest". Internal server error occurred while resolving "heineiuo/create-changelogs@master"

The code:

name: Generate Changelog

on:
 [push]
jobs:
  deploy:
     runs-on: ubuntu-latest


steps:
   - name: Checkout Code
     uses: actions/checkout@v3

   - name: Update CHANGELOG
     id: changelog
     uses: requarks/changelog-action@v1
     with:
       token: ${{ github.token }}
       tag: ${{ github.ref_name }}

   - name: Create Release
     uses: ncipollo/[email protected]
     with:
       allowUpdates: true
       draft: false
       makeLatest: true
       name: ${{ github.ref_name }}
       body: ${{ steps.changelog.outputs.changes }}
       token: ${{ github.token }}

   - name: Commit CHANGELOG.md
     uses: stefanzweifel/git-auto-commit-action@v4
     with:
       branch: main
       commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
       file_pattern: CHANGELOG.md

NullPointerException on commit.author.login

Hello,

I'm encountering an error when trying to generate a changelog on a repo. The action log doesn't show exactly which commit is concerned, but nothing caught my eye in the git log.

/home/runner/work/_actions/requarks/changelog-action/v1/dist/index.js:28278
          author: commit.author.login,
                                ^

TypeError: Cannot read properties of null (reading 'login')
    at main (/home/runner/work/_actions/requarks/changelog-action/v1/dist/index.js:28278:33)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Sorry I can't show you the repo we're using this on since it's private.

Feature Request - Plain Text Output Support

Hi,

Is it possible to support an optional plain text output.

I love the markdown output, however there are occasions where I need a plain text version.

One idea to do this would be to export to HTML, Render and export as plain text

Thank you

Provided tag doesn't match latest tag

I'm facing issue that changelog contains changes for previous tag (1.0.6 - 1.0.7) not latest one (1.0.7 - unreleased draft 1.0.8)

This is my release list

Снимок экрана от 2022-12-29 12-17-22

Workflow steps

  - name: Checkout code
    uses: actions/checkout@v2

  - name: Get Next Semantic Version
    id: semver
    uses: ietf-tools/semver-action@v1
    with:
      token: ${{ secrets.GITHUB_TOKEN }}
      branch: master

  - name: Update CHANGELOG
    id: changelog
    uses: requarks/changelog-action@main
    with:
      token: ${{ secrets.GITHUB_TOKEN }}
      tag: ${{ steps.semver.outputs.current }}
      writeToFile: false

  - name: Create Release
    uses: ncipollo/release-action@v1
    with:
      allowUpdates: true
      draft: true
      name: ${{ steps.semver.outputs.next }}
      tag: ${{ steps.semver.outputs.next }}
      body: |
        ## What's Changed :eyes:

        ${{ steps.changelog.outputs.changes }}

        **Full Changelog**: https://github.com/czernika/tailwindcss-grid-area/compare//${{ steps.semver.outputs.current }}...${{ steps.semver.outputs.next }}
      token: ${{ secrets.GITHUB_TOKEN }}

Action passed however it is generates wrong changelist (1.0.6 - 1.0.7)

Снимок экрана от 2022-12-29 12-17-35

If I'll set next version as tag: v1.0.8 or use range fromTag: v1.0.7 toTag: v1.0.8 it fails

Снимок экрана от 2022-12-29 12-22-25

feature requests: includeTypes option

I wish to only include some types in changelog, for example, feat, fix and revert.

it's not very easy to use excludeTypes, are you open to this feature? I can submit a pr for this.

Not running correctly when using squash merge

Hi, we are currently integrating this action into one of our repos but we are having problems with squash merges (using gitflow). The issue is that when, for instance, we develop a feature and then squash merge into develop then the commit message of this merge is structured as follows:

* feat: commit message 1
* bugfix: commit message 2
...

The problem is that when we create a release branch from this point in development, the action doesn't recognize the sub-commits specified in the squash merge commit, therefore not updating the CHANGELOG and version correctly.

Any idea how to deal with this?

non-lowercase types get ignored

A commit message of Fix: The thing gets identified as type "Fix" but then discarded:

Using input tag: v1.2.3
Using latest tag: v1.2.3
Using previous tag: v1.2.2
[OK] Commit <hash> of type Fix - The thing
Warning: Nothing to add to changelog because of excluded types.

(In my cases, excluded types here is set to: excludedtypes: '' to include everything)

Looking at the FAQ on https://www.conventionalcommits.org/en/v1.0.0/ these should not be case-sensitive:

Are the types in the commit title uppercase or lowercase?
Any casing may be used, but it’s best to be consistent.

Support `permissions: write-all`

I want this so I don't need to configure my GitHub token permissions... And I think using permissions: write-all is prettier.

BREAKING CHANGES message are not very ideal

I have a commit message fix!: add default client timeout transform into this changelog:

### :boom: BREAKING CHANGES
- due to [`5c809c6`](https://github.com/trim21/rtorrent-rpc/commit/5c809c6f5e286cee29ade47c424c6dbbe9a23b69) - add default client timeout *(commit by @trim21)*:

  add default client timeout

Not sure what is expected, but this message is not very ideal, add default client timeout repeat twice here.

can we hide it after commit sha, or change it to raw message? maybe:

### :boom: BREAKING CHANGES
- due to [`5c809c6`](https://github.com/trim21/rtorrent-rpc/commit/5c809c6f5e286cee29ade47c424c6dbbe9a23b69) - `fix!: add default client timeout` *(commit by @trim21)*:

  add default client timeout

Put newest version at the top

Hi @NGPixel,

do you have any plans to allow adding the newest version at the top of the changelog?
For a long-lived project, readers always have to scroll down quite a bit otherwise.

Thanks for creating this!
One manual step less for my OS projects 😄

changelog is not included in the tagged version/release

Since this flow gets triggered after the tag is already pushed and then it cuts a release, the changelog commit is not included in the release. Wouldn't it make sense for the changelog to be included in the release, and is there a way to do that using this tool?

Feature Request - add support for GHE

Hi,

I found that currently https://github.com is hard coded in the code base.

You can add support for GitHub Enterprise with something like this:

module.exports = require("process");

const githubServerUrl = process.env.GITHUB_SERVER_URL || 'https://github.com';

all supported GitHub versions should have this environment variable available https://docs.github.com/en/actions/learn-github-actions/variables

Currently, the links in the CHANGELOG to PRs or version compare, will 404 if you are on GHE.

Regards,
Andreas

Optional - Include commits with unconventional commit messages

Sometimes we have commits with non-conventional commit messages, and these are excluded from the generated changelog.

It would be useful to include these in the changeling, possibly in a separate section, I imagine the action would then look like this:

- name: Update CHANGELOG
        id: changelog
        uses: Requarks/changelog-action@v1
        with:
          token: ${{ github.token }}
          tag: ${{ github.ref_name }}
          excludeTypes: ""
          includeUnconventionalCommits: true

Feature: Exclude commits to certain files

I regularly edit files like readme.md or build.yml, but I dont want those changes to end up in the changelog.

From the documentation I saw its possible to exclude certain commit types, but that requires me to always remember to add a type to every commit.

Would it be possible to just exclude commits to certain filenames (or file extensions). So I can just exclude readme.md or *.md and dont have to worry about types?

Feature request: `includeScopes`

We have excludeScopes which is nice, but the opposite would be quite useful for monorepos.

includeScopes should accept a list of scopes which will filter the changelist of the changelog.

This is useful in monorepo setups, where you have different releases for different parts of the project. The tagFrom and tagTo are already quite useful because you can filter for subproject-v0.1.1 to subproject-v0.1.0. However, right now every release shows either all scopes (even if a commit didn't affect a certain release) or I can exclude the others, which woudl require to build a list of all subprojects and then removing the current one. With includeScopes I could just set that to includeScopes: subproject,ci and it would filter for my project (and optinally other generic scopes).

Feature Request - no valid commits should not fail

Love the action: I use it to draft release notes with writeToFile: false

At the moment the action will fail if there are no valid commits.

when there are no valid commits it fails with:

Error: No valid commits parsed since previous tag.

I would love to be able to skip the next step (for me here drafting the release) with an if like this:

if: >-
  steps.changelog.outputs.changes  != 'NA'

If there are no valid commits just return 'NA' or '' when not writing to file.
This could also be just an additional mode failWhenResultEmpty: true|false where true is the default and the current behaviour.

Cheers,
Andreas

Commits excluded by scope still generate a subtitle entry

If all commits of a certain type get filtered by excludeScopes, a sub-title for the corresponding type is still added in the changelog.

Example:

      excludeScopes: 'bar'
fix(foo): some fix
refactor(bar): some refactor

The result is like:

### :bug: Bug Fixes
- [`commit sha`](commit link) - **foo**: some fix

### :recycle: Refactors

Distinguish between `build` and `ci` commit types

"build" and "ci" commit types are currently treated in the same group in the action.

This has been confusing to me, I used the action with the option:

    excludeTypes: ci,style,chore,other

and expected that "build" commits (that affect my build tool) would be written in the changelog (while I don't want to write about "ci" commits, since changes on the workflow don't affect the delivered code in the end).

Yet, in the logs of the action I had something like this:

Run requarks/changelog-action@v1
Using tag range: ... to ...
[OK] Commit ... of type build - some build commit
[OK] Commit ... of type ci - some ci commit
Selected Types: feat, feature, fix, bugfix, perf, refactor, test, tests, doc, docs

(No build, even if it is not in the excludeTypes)


If I get it correctly, the reason is that 'build' and 'ci' are in the same array in allTypes constant:

{ types: ['build', 'ci'], header: 'Build System', icon: ':construction_worker:' },

const allTypes = [
  { types: ['feat', 'feature'], header: 'New Features', icon: ':sparkles:' },
  { types: ['fix', 'bugfix'], header: 'Bug Fixes', icon: ':bug:', relIssuePrefix: 'fixes' },
  { types: ['perf'], header: 'Performance Improvements', icon: ':zap:' },
  { types: ['refactor'], header: 'Refactors', icon: ':recycle:' },
  { types: ['test', 'tests'], header: 'Tests', icon: ':white_check_mark:' },
  { types: ['build', 'ci'], header: 'Build System', icon: ':construction_worker:' },
  { types: ['doc', 'docs'], header: 'Documentation Changes', icon: ':memo:' },
  { types: ['style'], header: 'Code Style Changes', icon: ':art:' },
  { types: ['chore'], header: 'Chores', icon: ':wrench:' },
  { types: ['other'], header: 'Other Changes', icon: ':flying_saucer:' }
]

which causes to filter both if one of the two is selected:

if (_.intersection(type.types, excludeTypes).length === 0) {

  // -> Filter types
  const types = []
  for (const type of allTypes) {
    if (restrictToTypes.length > 0) {
      if (_.intersection(type.types, restrictToTypes).length > 0) {
        types.push(type)
      }
    } else {
      if (_.intersection(type.types, excludeTypes).length === 0) {
        types.push(type)
      }
    }
  }
  core.info(`Selected Types: ${types.map(t => t.types.join(', ')).join(', ')}`)

There is two ways to resolve this:

  • add a bit of documentation about it in the readme
  • do a little refactor to fix this

It seems to me that the latter would be convenient, I'll link a pull request.

How to prevent workflow failing of the very first release (when no previous tag exists)?

I've read the note in the documentation:

You must already have 2 tags in your repository (1 previous tag + the current latest tag triggering the job). The job will exit with an error if it can't find the previous tag!

My question is how to prevent the workflow failing caused when no previous tag exists. I think that this should be documented too, at least with some code snippers. Because on a brand new project, this is going to 100% fail for obvious reasons.

Of course one can:

  1. Create the first tag and push it
  2. Manually create a the first release based on the tag above
  3. Add the workflow

... but this is very incovenient.

name: Release

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Update CHANGELOG
        id: changelog
        uses: requarks/changelog-action@v1
        with:
          token: ${{ github.token }}
          tag: ${{ github.ref_name }}

      - name: Create Release
        uses: ncipollo/release-action@v1
        with:
          allowUpdates: true
          makeLatest: true
          body: ${{ steps.changelog.outputs.changes }}
          token: ${{ github.token }}

      - name: Commit CHANGELOG.md
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          branch: main
          commit_message: 'chore(docs): Update CHANGELOG.md for ${{ github.ref_name }} [ci skip]'
          file_pattern: CHANGELOG.md

Item sort order within category is backwards

Hi,
I'm testing this action and so far its mostly working pretty well, but I have noticed that within a release category (Bug Fixes, Build System, etc) each item is listed with the latest version at the bottom of the list. This seems at odds with the norm and with the Release order which has the latest first.

thoughts?

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.