Skip to content
clock

GitHub Action

Extract changes

v2.0.0 Latest version

Extract changes

clock

Extract changes

Extract changes from keep a changelog for some version

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Extract changes

uses: ultram4rine/extract-changes-action@v2.0.0

Learn more about this action in ultram4rine/extract-changes-action

Choose a version

extract-changes-action

Replacement of

awk -v ver=$(grep 'version' package.json | awk -F: '{ print $2 }' | tr -d \ \",) '/^#+ \[/ { if (p) { exit }; if ($2 == "["ver"]") { p=1; next } } p && NF' CHANGELOG.md > changes.txt

Extract changes from keep a changelog for some version. Companion for softprops/action-gh-release.

Inputs

changelog

Required The name of the changelog file. Default "CHANGELOG.md".

version

Required The version for which you want to extract the changes.

output

The name of the output file.

Outputs

changes

Changes of the specified version.

Example usage

steps:
  - name: Checkout
    uses: actions/checkout@v4

  - name: Get the version
    id: get_version
    run: echo VERSION=$(jq -r .version package.json) >> $GITHUB_OUTPUT

  - name: Create release body
    id: extract_changes
    uses: ultram4rine/extract-changes-action@v2
    with:
      changelog: CHANGELOG.md
      version: ${{ steps.get_version.outputs.VERSION }}

  - name: Create release
    uses: softprops/action-gh-release@v2
    with:
      body: ${{ steps.extract_changes.outputs.changes }}