Skip to content
align-left

GitHub Action

Extract Release Notes

v2.2.0 Latest version

Extract Release Notes

align-left

Extract Release Notes

Extract release notes from a "Keep a Changelog" changelog file

Installation

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

              

- name: Extract Release Notes

uses: ffurrer2/[email protected]

Learn more about this action in ffurrer2/extract-release-notes

Choose a version

Extract Release Notes

CI MIT License GitHub Release

This GitHub Action extracts release notes from a Keep a Changelog formatted changelog file.

Usage

Prerequisites

  • Create a CHANGELOG.md file based on the changelog format of the Keep a Changelog project.
  • Create a workflow .yml file in your .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.

Inputs

Input Description
changelog_file (optional) The input path of the changelog file. Default: CHANGELOG.md
release_notes_file (optional) The output path of the (optional) release notes file.

Outputs

Output Description
release_notes The escaped release notes.

Example workflow - create a release with release notes

On every push to a tag matching the pattern *.*.*, extract the release notes from the CHANGELOG.md file and create a release:

name: Create Release

on:
  push:
    tags:
      - '*.*.*'

jobs:
  release:
    name: Create release
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Extract release notes
        id: extract-release-notes
        uses: ffurrer2/extract-release-notes@v2
      - name: Create release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: gh release create ${{ github.ref_name }} --notes '${{ steps.extract-release-notes.outputs.release_notes }}'

This code will extract the content between the second and third H2 header from the CHANGELOG.md file, store this content in the output variable release_notes and create a release using the gh release create command.

Examples

Use a dedicated changelog file

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Extract release notes
        id: extract-release-notes
        uses: ffurrer2/extract-release-notes@v2
        with:
          changelog_file: MY_CHANGELOG.md

Create a release notes file

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Extract release notes
        uses: ffurrer2/extract-release-notes@v2
        with:
          release_notes_file: RELEASE_NOTES.md

Extract prerelease notes

To extract the content between the first (## [Unreleased]) and second H2 header, set the prerelease parameter to true.

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Extract release notes
        uses: ffurrer2/extract-release-notes@v2
        with:
          prerelease: true

License

This project is licensed under the MIT License.