This is a GitHub Action to update a changelog file based on git commits. If one is not found, a blank one will be created based on this template and updated going forward. The action will NOT attempt to create a complete changelog based on previous commits.
The action assumes you use semver and a ticketing system, and that you format branch names according to
TICKET-ID/ChangeType/Description_of_change
.
For example, if a pull request being merged has the branch PROJ-1234/Added/Update_profile_picture
, this action
will update the changelog to have a new entry like:
- Update profile picture
NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
---|---|---|---|---|
branch_name |
Overrides the branch name to parse for the message. Default is name of current branch. | string |
false |
current branch |
changelog_file |
Overrides the path to the changelog. Default is ./CHANGELOG.md | string |
false |
CHANGELOG.md |
ticket_url_prefix |
If provided, will be used to create a link for referenced issues. (Make sure to include ending slash if needed. This allows ticket to be param as well.) | string |
false |
N/A |
version |
The version of the release will be added above this change. | string |
true |
N/A |
NAME | DESCRIPTION | TYPE |
---|---|---|
change_md |
The Markdown that was generated for this change. | string |
name: Update Changelog
on:
pull_request:
types: [closed]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: KrogerWalt/action-get-latest-tag@v3
id: get-latest-tag
- uses: actions-ecosystem/action-bump-semver@v1
id: bump-semver
if: ${{ steps.release-label.outputs.level != null }}
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: ${{ steps.release-label.outputs.level || 'patch' }}
- uses: KrogerWalt/action-update-changelog@v1
id: changelog-update
if: ${{ github.event.pull_request.merged == true }}
with:
ticket_url_prefix: https://jira.yourcompany.com/jira/browse/
version: ${{ steps.bump-semver.outputs.new_version }}
- name: Push Changelog to git
...
Copyright 2021 KrogerWalt.
Action Release Label is released under the Apache License 2.0.