Giter Site home page Giter Site logo

mindsers / changelog-reader-action Goto Github PK

View Code? Open in Web Editor NEW
89.0 89.0 44.0 559 KB

A GitHub action to read and get data from the CHANGELOG.md file πŸš€

License: MIT License

JavaScript 100.00%
actions changelog github github-actions hacktoberfest workflow

changelog-reader-action's Introduction

Hi there πŸ‘‹

I'm NathanaΓ«l Cherrier. I'm a full-time software engineer passionate about writing clean, beautiful and well-designed code. On my free time, I try to give back to open source by maintaining open source projects and contributing to others.

I'm also a tech content creator. I write tech posts, courses and tutorials to help people from beginner to advanced to learn and grow as a developer.

A few fun facts about me :

  • πŸ”­ I’m currently working on the mobile app of Steply
  • 🌱 I’m currently learning Infrastructure as Code
  • πŸ‘― I’m looking to collaborate on JS and Swift projects
  • πŸ€” I’m looking for help with Changelog Reader (GH Action)
  • πŸ’¬ Ask me about anything dev related
  • πŸ“« How to reach me: on my website contact forms
  • πŸ˜„ Pronouns: he/his

changelog-reader-action's People

Contributors

alexesprit avatar allcontributors[bot] avatar andrekosak avatar danilogco avatar dependabot[bot] avatar endormi avatar farfromrefug avatar mindsers avatar mrks115 avatar nathany-copia avatar stronk7 avatar svenstaro 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

Watchers

 avatar  avatar

changelog-reader-action's Issues

Preleases in Python do not parse appropriately

First of all, thanks for making this awesome action! I've been really needing something to essentially lint and extract CHANGELOG.md details into a GH release.

That said, I did find some issues when trying to utilize this for Python pip packages. As you may or may not know, the regex for Python pip versions in PyPi is quite strict. So there are a limited number of ways that prereleases can be defined. Specifically, when we define a version as 0.1.0a1, the parsing fails along with the prerelease designation. Did some debugging myself and determined that the only issue is that the hyphen (-) is strictly enforced for prereleases.

I have a version that works for our needs on my fork but unsure how it will affect other use-cases. I'll soon issue a PR so that we can discuss any unwanted impact to see if we can determine a good way to handle all cases including Python prereleases.

Link references are filtered out from version entry

I'm working on automating the release process for https://github.com/yannickcr/eslint-plugin-react and ran into an issue where the changelog format used doesn't fully work with this action.

Example version entry:

## [7.29.1] - 2022.02.25

### Fixed

* [`jsx-key`]: prevent false "missing array key" warning ([#3215][] @ljharb)
* [`jsx-indent`]: avoid checking returns sans jsx ([#3218][] @ljharb)
* [`jsx-key`]: avoid a crash ([#3220][] @ljharb)
* version settings: avoid a crash with an invalid version ([#3219][] @ljharb)

[7.29.1]: https://github.com/yannickcr/eslint-plugin-react/compare/v7.29.0...v7.29.1
[#3220]: https://github.com/yannickcr/eslint-plugin-react/issues/3220
[#3219]: https://github.com/yannickcr/eslint-plugin-react/issues/3219
[#3218]: https://github.com/yannickcr/eslint-plugin-react/issues/3218
[#3215]: https://github.com/yannickcr/eslint-plugin-react/issues/3215

There's two issues due to using link references.

  1. Common links are referenced at the end of the file. In this example [`jsx-key`].
  2. Version specific links are referenced at the end of the section before the next version.

I worked around the first issue by pulling the common links out in another step and appending them to the release notes.

The second issue is happening because of this line

.filter(item => !/\[.*\]: http/.test(item))

What's the reason for excluding these? Would you be open to adding a new setting to skip this filter?

latest version does not capture changelog content

Since the latest update (v2.1.0), the contents of the changelog are not captured and outputted by the action.


workflow affected

workflow run

affected workflow step debug log
##[debug]Evaluating condition for step: 'Get Changelog Content'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Get Changelog Content
##[debug]Loading inputs
##[debug]Evaluating: env.version_num
##[debug]Evaluating Index:
##[debug]..Evaluating env:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'version_num'
##[debug]=> '1.1.0'
##[debug]Result: '1.1.0'
##[debug]Loading env
Run mindsers/changelog-reader-action@v[2](https://github.com/0x5c/hexchat-void-repos/runs/7059293304?check_suite_focus=true#step:4:2)
::group::Parse data
Parse data
::group::Validate data
Validate data
::set-output name=version::1.1.0
##[debug]steps.changelog_reader.outputs.version='1.1.0'
::set-output name=date::2022-0[6](https://github.com/0x5c/hexchat-void-repos/runs/7059293304?check_suite_focus=true#step:4:6)-26
##[debug]steps.changelog_reader.outputs.date='2022-06-26'
::set-output name=status::released
##[debug]steps.changelog_reader.outputs.status='released'
::set-output name=changes::
##[debug]steps.changelog_reader.outputs.changes=''
##[debug]Node Action run completed with exit code 0
##[debug]Finishing: Get Changelog Content

Upgrade node version used by the action from 12 to 16

Deprecation notice is being thrown. Can this get bumped from 12 to 16?

Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: <snip>, mindsers/changelog-reader-action, <snip>

Getting ##[error](intermediate value)(intermediate value)(intermediate value) is not iterable

Hey, I really like this action but sadly somehow it fails currently with my CHANGELOG.md with error:

  ##[error](intermediate value)(intermediate value)(intermediate value) is not iterable

See log here: https://github.com/svenstaro/site24x7_exporter/runs/842970939?check_suite_focus=true
My CHANGELOG.md: https://github.com/svenstaro/site24x7_exporter/blob/eca02aa02160f9c22d9145eb1bc5dfb08988b9b8/CHANGELOG.md

I believe my CHANGELOG.md is compliant to the expected format but obviously something throws the action off.

The vague output makes it fairly hard to see what the error is, sadly.

Add validation of the changelog

It would be nice to have some basic validation of the changelog to ensure developers are incrementing the version in accordance with Semantic Versioning standards and Keep a Changelog formatting.

Proposed Validation Rules:

  1. The version is a valid semantic version.
  2. The versions are sorted in reverse chronological order.
  3. That each specified section (Added, Changed, Removed, etc) actually has changes listed underneath them.
  4. Enforce that only specified types are allowed for changes between versions.
    1. Major releases allow sections for added, removed, changed, deprecated, fixed, and security
    2. Minor releases allow sections for added (non-breaking), changed (non-breaking), deprecated, fixed, and security
    3. Patch and below releases allow sections for fixed, and security

Adding an input param such as validation_depth would allow users to configure how much, if any, of their changelog they would like to have validated. Setting a depth to 0 would, in sense, disable validation. This would be a helpful setting in case the codebase maybe had a change log that didn't follow standards when it was started.

[Question] Finding a CHANGELOG.md dynamically?

I have a workflow that is triggered when new tags are created, and I don't always know the path to the CHANGELOG.md file. I'm trying to accomplish something like this:

- name: Get path for changelog
  id: changelog_path
  shell: bash
  run: |
    echo ::set-output name=path::$(ls ./**/${{ steps.app_short_name.outputs.name }}/CHANGELOG.md)
- name: Extract changelog
  if: ${{ steps.app_short_name.outputs.name && steps.check.outputs.result != 'stop' }}
  id: changelog_reader
  uses: mindsers/changelog-reader-action@v1
  with:
    version: steps.tag_version.outputs.current_version
    path: steps.changelog_path.outputs.path

Sadly this seems to fail, even though the path it's searching for returns a valid changelog. But maybe I'm going about this the wrong way. Any help is appreciated!

Version's sections are restricted

In my changelog file I already had a entry:

## [1.0.0-beta.0] - 2022-07-20

### Added

- Initial project files

When adding another entry for 1.0.0-beta.1 I end up getting this error message:
Only 'fixed, security' sections are allowed

So the current entries look like this:

## [1.0.0-beta.1] - 2022-07-24

### Added

- Interceptor adding a Bearer Token to HTTP requests with an URL matching the defined regular expression

## [1.0.0-beta.0] - 2022-07-20

### Added

- Initial project files

As far as I see there's no reason why I shouldn't be able to have an added section for my new version as well.

exporting changelog entry to tmp file

Would you be open to a contribution that allows changelog-reader-action to export a tmp file path that contains the changelog entry? This would be helpful to avoid shell escape sequence on richer markdown content. I've ran into issues with this for integrations that require a path to a file containing release notes (like goreleaser for example). I'd be happy to contribute this feature if you'd be open to it πŸ‘

I was thinking:
outputs.changesFile - a path to a temporary file containing the text for the changelog entry.

Then I can use it like so:

name: release

on:
  push:
    tags:
      - 'v*'

jobs:
  goreleaser:
    runs-on: ubuntu-latest
    steps:
      - name: Extract Version from Tag
        id: tag_name
        run: |
          echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
        shell: bash

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

      - name: Generate Release Changes
        id: changelog_reader
        uses: mindsers/changelog-reader-action@v2
        with:
          version: ${{ steps.tag_name.outputs.current_version }}

      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.18

      - name: Login to Docker Hub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v2
        with:
          distribution: goreleaser
          version: latest
          args: release --rm-dist --release-notes ${{ steps.changelog_reader.outputs.changesFile }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Does not match "unreleased" section

I am trying to create unstable releases and use the Unreleased section in a CHANGELOG.md.

I was hoping that instead of grepping for ## headers that match a v1.2.3-style semantic version, that when the version was missing, this action would simply pick the first sub-header, regardless of its title.

What do you think about this? Either, supporting "Unreleased" (and similar) as valid version identifier or just taking the versions[0] instead of running it through findVersionById?

Warning about 'validation_depth'

With the following config and a CHANGELOG.md that only has an [Unreleased] section, I get this warning: Warning: Unexpected input(s) 'validation_depth', valid inputs are ['path', 'version']

Config

      - name: Validate changelog
        uses: mindsers/changelog-reader-action@v2
        with:
          validation_depth: 10
          version: Unreleased

The reader not fully support semantic versioning (https://semver.org/)

Hello there!
First of all, thank you for the great tool! We integrated it into our pipelines for several of our projects and it works well in most cases, but not in all of the cases.

It looks like the tool only supports simple cases of versioning (MAJOR.MINOR.PATCH format), but ignores entities in CHANGELOG.md which contains pre-release and/or build metadata information.

Well, I understand it might be up to the author which version standard to support but it looks like "semver" is well-documented and therefore wide-spread.
E.G:
NodeJS: https://github.com/conventional-changelog/standard-version

Your can check out for the details, documentation and test cases on: https://semver.org/

Thanks!

Add warning and error messages for the validation feature

Improve the validation feature by adding human readable messages that explain what validation rules break the workflow.

It should act like a regular linter.

Current behavior

Putting validation_depth at more than 0 can break the workflow. Which is expected. But the end user doesn't know what is currently breaking the workflow.

Expected behavior

Display in the standard output the reason why a workflow is broken by this action.

Inspiration

Something like the other linter's output would be awesome:

screenshot

Replace newline with spaces

The output body in Markdown format with a newline will make the release body keep newlines.

The one newline should show as space with Markdown format, and the multi newlines should show as one newline.

Could you parse the changelog body with the correct format to output?

Use a configuration file

A next step for the action would be to support a configuration file stored in the repository. The goal is to make the configuration "versionable".

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.