dangoslen / changelog-enforcer

A simple GitHub action that enforces that a maintained changelog is kept up to date.
MIT License
56 stars 25 forks source link
actions actionshackathon changelog javascript project-management

unit tests badge latest version coverage badge

Changelog Enforcer

The purpose of this action is to enforce that every pull request in a repository includes a change to an ongoing changelog file. Inspired by KeepAChangelog, this action helps development teams to keep a change file up to date as new features or fixes are implemented.

Usage

To use this action, follow the typical GitHub Action uses syntax. An example workflow using the default parameters of this action is shown below:

name: "Pull Request Workflow"
on:
  pull_request:
    # The specific activity types are listed here to include "labeled" and "unlabeled"
    # (which are not included by default for the "pull_request" trigger).
    # This is needed to allow skipping enforcement of the changelog in PRs with specific labels,
    # as defined in the (optional) "skipLabels" property.
    types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
  # Enforces the update of a changelog file on every pull request 
  changelog:
    runs-on: ubuntu-latest
    steps:
    - uses: dangoslen/changelog-enforcer@v3

Other examples can be seen in the example-workflows directory in this repository.

_:warning: The Changelog Enforcer is designed to be used with the pull_request or pull_request_target event types. Using this action on any other event type will result in a warning logged and the action succeeding (as to not block the rest of a workflow)._

Inputs / Properties

Below are the properties allowed by the Changelog Enforcer. These properties are shipped with sane defaults for typical use, especially for changelogs inline with the KeepAChangelog format.

changeLogPath

skipLabels

missingUpdateErrorMessage

expectedLatestVersion

versionPattern

token

Outputs

errorMessage

Creating Releases Automatically

Using this Action and the Changelog Reader, plus a few standard GitHub created Actions, we can keep the changelog of a project up to date and create a GitHub release automatically with contents from the changelog. See this project's release.yml for how to set up a simple workflow to create a new release based on a VERSION file and a changelog.