Giter Site home page Giter Site logo

keep-a-changelog-new-release's Introduction

Keep A Changelog - New Release

This GitHub action will update your CHANGELOG.md for a new release:

  • Changes the 'unreleased' section to the new version
  • Updates the links to the tags at the end of the file
  • Inserts a new 'unreleased' section at the top

Here is a diff from one of the test cases:

diff --git a/./__tests__/fixtures/standard/CHANGELOG.md b/./__tests__/fixtures/standard/CHANGELOG.expected.md
index bc86d0e..08101e3 100644
--- a/./__tests__/fixtures/standard/CHANGELOG.md
+++ b/./__tests__/fixtures/standard/CHANGELOG.expected.md
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased]
 
+## [0.3.0] - 2019-12-06
+
 ### Changed
 
 -   Our main theme is now blue instead of red.
@@ -28,7 +30,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 -   Initial release :tada:
 
-[Unreleased]: https://github.com/foo/bar/compare/0.2.0...HEAD
+[Unreleased]: https://github.com/foo/bar/compare/0.3.0...HEAD
+
+[0.3.0]: https://github.com/foo/bar/compare/0.2.0...0.3.0
 
 [0.2.0]: https://github.com/foo/bar/compare/0.1.0...0.2.0
 

Usage

Within a workflow, you can use it like this:

name: "..."
on: ...

jobs:
  update-changelog:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    
    - name: Update changelog
      uses: thomaseizinger/keep-a-changelog-new-release@v2
      with:
        tag: v0.6.0 # You probably want to have this dynamic :)

The action will do nothing else apart from modifying the changelog. It neither creates a commit, nor does it push anything to anywhere. You will have to do that as part of your workflow if you need this behaviour.

Checkout this blogpost or this repository for a set of workflows of an automated release using GitFlow and Github actions.

keep-a-changelog-new-release's People

Contributors

dervexdev avatar h4sh3d avatar markosagadin avatar markuspoerschke avatar thomaseizinger 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

Watchers

 avatar  avatar  avatar  avatar  avatar

keep-a-changelog-new-release's Issues

Action doesn't properly handle `prettier` formatted Markdown

My changelog was roughly

## [Unreleased][unreleased]
Bunch of stuff here
## [0.6.2][] - 2022-08-31
...
[unreleased]: https://github.com/user/repo/compare/0.6.2...HEAD
[0.6.2]: https://github.com/user/repo/compare/0.6.1...0.6.2
...

and after running this action on it, the file was changed to

## [Unreleased]

## [1.0.0] - 2023-09-09
Bunch of stuff here
## [0.6.2][] - 2022-08-31
...
[unreleased]: https://github.com/user/repo/compare/0.6.2...HEAD
[0.6.2]: https://github.com/user/repo/compare/0.6.1...0.6.2
...

[Unreleased]: https://github.com/Questionable-Content-Extensions/client/compare/1.0.0...HEAD

[1.0.0]: https://github.com/user/repo/compare/0.6.2...1.0.0

i.e. the original [unreleased] link was left alone and a new one was created at the end, along with the new one for the new version. The problem is, at least on GitHub, [unreleased] and [Unreleased] are both the same, and my change log's Unreleased heading ended up still linking to the compare/0.6.2...HEAD rather than the new compare/1.0.0...HEAD, presumably because it was earlier in the document.

I think whatever parsing is used in this action needs some robustness added to not make these mistakes.

Action reformats changelog file

Running the action does not only move the [Unreleased] section to a new one, but also reformats the whole changelog file . For example, in my case lists were reformatted as so:

# Initially the list looked like this:
- abc
- def

# After running the action, it looks like this (i.e. more spaces are added):
-   abc
-   def

It would be great if this could be suppressed (or at least customized), since the reformatting could clash with other actions (e.g. linting).

Readme contains invalid example

Hi, the readme shows

    - name: Update changelog
      uses: thomaseizinger/keep-a-changelog-new-release@v1
      with:
        tag: v0.6.0 # You probably want to have this dynamic :)

But this will load the action from branch v1 which is 1.2.1 which does not have a tag parameter and requires a version parameter. So using the example as it is you'll get:

Error: Input required and not supplied: version

The fix is probably to ff merge the v1 branch to master, if there is no urgent reason to keep it on 1.2.1. Thx

Deprecated node12

Hello,

I have been a happy user of your Github Action on several projects!

I have noticed some time ago that my workflows started emitting an warning related to the deprecation of the node12:

Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: actions/checkout@v2, thomaseizinger/[email protected]. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.

I am super familiar with javascript and typescript, but I could take a look at the issue.

Could you give me some hints where should I start looking?

I can see that action.yaml specifies node12, but there are also packages in the pacakge.json file that probably need to be updated.

Create `v3` branch

Would be nice to use:

uses: thomaseizinger/keep-a-changelog-new-release@v3

instead of:

uses: thomaseizinger/[email protected]

same as there are v1 and v2 branches.

DeprecationWarning

I am getting following warning:

Run thomaseizinger/keep-a-changelog-new-release@v1
(node:1697) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

Update remark-parse version to fix security vulnerability

๐Ÿ‘‹๐Ÿผ Hey @thomaseizinger!
Nice to meet you!

I am using your action to update the app's CHANGELOG but I found there is a high-security vulnerability on one of the dependencies (remark-parse) you are using as you can see in this security report from the Synk tool:

CleanShot 2024-04-16 at 13 58 54@2x

I would like to keep using your action, but for that, it is mandatory that this vulnerability be fixed. Could we do a quick update on this dependency to the 9.0.0 version?

Thanks in advance ๐Ÿ™‚

Bug: Modified spacing for Markdown lists in the Changelog

TL;DR: This action adds two extra spaces to each markdown-list element in the changelog.

Currently, when processing the following example:

## [Unreleased]

This release does one thing

### Added

- List with one space

The action produces the following output:

## [Unreleased]

## [v0.0.9] - 2021-04-03

This release does one thing

### Added

-   List with one space

However, the expected output is:

## [Unreleased]

## [v0.0.9] - 2021-04-03

This release does one thing

### Added

- List with one space

Literally, it adds two extra spaces for each list item.
It changes (_ denotes a space):

-_List with one space

into

-___List with one space

I think the list entries should remain unmodified due to the following reasons:

  1. https://keepachangelog.com/en/1.0.0/ defines them with a single space
  2. Using 3 spaces triggers markdown-lint warning: MD030/list-marker-space: Spaces after list markers [Expected: 1; Actual: 3] markdownlint (MD030)

It would be great if this could be fixed ๐Ÿ™‚

feature request: add a `release-notes` output to the action

Hey, awesome action, been using it for years now ๐Ÿ˜„

I would find it very useful if the action was providing the rotated release notes as an output (https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#outputs-for-docker-container-and-javascript-actions).

This would allow feeding the release notes right into the GitHub Releases API when creating a new release, and avoid the need to set it up separately.

Error: The process '/usr/bin/git' failed with exit code 128

I'm using a fully permissive GITHUB_TOKEN
If I use a very old ubuntu 20.04 base image to run this it works, but if I build anything newer (even latest 20.04) I get this error using your plugin:

Run thomaseizinger/[email protected]
/usr/bin/docker exec  ee6db47427b4519a75090d994741ab3b31d447aa5a4cd81f8c4004d201458657 sh -c "cat /etc/*release | grep ^ID"
(node:144) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Error: The process '/usr/bin/git' failed with exit code 128

It would be nice to at least get the actual reason here

Add option to control prefix of version in compare urls

When creating a release, I like to use tags with the name vX.Y to indicate an release. In my changelog, I prefer just to have [X.Y] - YYYY-MM-DD as the heading for each release.

That means the current logic for generating the compare urls wont work for me. So I think something like this is needed:

 const unreleasedCompareUrl = `https://github.com/${owner}/${repo}/compare/${compareUrlVersionPrefix}${newVersion}...HEAD`; 
 const previousVersionCompareUrl = previousVersion 
   ? `https://github.com/${owner}/${repo}/compare/${compareUrlVersionPrefix}${previousVersion}...${compareUrlVersionPrefix}${newVersion}` 
   : `https://github.com/${owner}/${repo}/compare/${compareUrlVersionPrefix}${genesisHash}...${compareUrlVersionPrefix}${newVersion}`; 

instead of this:

const unreleasedCompareUrl = `https://github.com/${owner}/${repo}/compare/${newVersion}...HEAD`;
const previousVersionCompareUrl = previousVersion
? `https://github.com/${owner}/${repo}/compare/${previousVersion}...${newVersion}`
: `https://github.com/${owner}/${repo}/compare/${genesisHash}...${newVersion}`;

Its been a very long time since I last played with TypeScript, but ill give this a go if you want a PR on this :)

Action doesn't support headers linking to github releases

I like to use the following format in the footer of my changelog so my release headers link to the github release pages themselves, but this doesn't appear to be supported with this action:

[Unreleased]: https://github.com/foo/bar/compare/v0.0.2...HEAD
[0.0.2]: https://github.com/foo/bar/releases/tag/v0.0.2
[0.0.1]: https://github.com/foo/bar/releases/tag/v0.0.1

When I run the action I get the following error:

Run thomaseizinger/[email protected]
(node:1591) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Error: Invalid changelog format, compare url is not standard

Action code:

      - name: Update Changelog
        uses: thomaseizinger/[email protected]
        with:
          tag: ${{ github.ref_name }}

Is this something you would be able to support in future? Perhaps by detecting the format and using it automatically.

Fails to get version on first release

Hi, great action!

I noticed that per keep-a-changelog spec, if you have a fresh changelog (1.0.0) then this action will fail.

It is looking for ... separator that doesn't exist on ...release/tag/1.0.0

const split = link.split("...");

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.0.0] - 2022-02-08

### Added

-   Initial release of this action!

[Unreleased]: https://github.com/me/myapp/compare/1.0.0...HEAD

[1.0.0]: https://github.com/me/myapp/releases/tag/1.0.0

My workaround for now is to change the url to .../compare/1.0.0...1.0.0

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.