Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
file-text

GitHub Action

gitchangelog-action

0.1.0

gitchangelog-action

file-text

gitchangelog-action

Generate nice changelogs, eg, for the github release page

Installation

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

              

- name: gitchangelog-action

uses: sarnold/gitchangelog-action@0.1.0

Learn more about this action in sarnold/gitchangelog-action

Choose a version

A Github Action for gitchangelog

gitchangelog-action

CI test status GitHub tag License

What is gitchangelog?

gitchangelog creates a changelog from git log history using multiple template engines and a config file. Output can be either reStructuredText or MarkDown, with the latter format as default for this action (mainly for generating GitHub release pages).

By default this action will ues the gitchangelog.rc.github.release config file installed by the gitchangelog package.

Usage

Create a .yml file under .github/workflows with the following contents.

Default configuration

name: gitchangelog
on: [push]

jobs:
  release:
    name: gitchangelog-action
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: gitchangelog action step
        uses: sarnold/gitchangelog-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN}}

Full configuration

name: gitchangelog
on:
  push:
    # trigger a release on any tag push
    tags:
      - '*'

jobs:
  build:
    # build stuff here to create release artifacts if needed

  release:
    name: gitchangelog with gh-release action
    runs-on: ubuntu-latest
    steps:
      - name: Get version
        id: get_version
        run: |
          echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
          echo ${{ VERSION }}

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

      - name: Generate changes file
        uses: sarnold/gitchangelog-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN}}

      - name: Create release
        uses: softprops/action-gh-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ env.VERSION }}
          name: Release ${{ env.VERSION }}
          body_path: CHANGES.md
          draft: true
          prerelease: false

Input Options

Note

All input options are optional except github_token. By default, the commit_changelog option uses --dry-run so you can see what it would do before you actually enable it.

github_token:GITHUB_TOKEN secret (automatically provided by Github)
config_file:Path to gitchangelog.rc (default: Markdown release cfg)
output_file:Filename for changelog (default: CHANGES.md)
extra_sort:Additionally sort the list of found tags (default: False)
no_args:Pass no ref args to gitchangelog (always generate full changelog)
commit_changelog:Whether to commit the changelog file (default: false)
target_branch:Branch that the action will target (default: current branch)

Input Constraints

  • target_branch will not create a new branch (you must create and push the branch before enabling this option)

Please refer to the gitchangelog readme doument for further details.

Operating System Support

This action runs in a Docker container and requires the Ubuntu CI runner. In your workflow job configuration, you should set the runs-on property to ubuntu-latest:

jobs:
  release:
    runs-on: ubuntu-latest

The gitchangelog tool itself is built and tested in github CI using Linux, Macos, and Windows, so you can always generate output on your local machine as needed.