Skip to content

ultram4rine/extract-changes-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

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 }}