Git Product home page Git Product logo

changelog-enforcer's Introduction

Public workflows that use this action. unit tests badge latest version coverage badge

Changelog Enforcer

The purpose of this action is to enforce a change to a ongoing changelog file. Inspired by Keep A Changelog, this action helps development teams to keep a change file up to date as new features or fixes are implemented.

Usage

To use, follow the typical GitHub Action uses syntax.

Requires the common Checkout Action as shown below! The enforcement of change is done all using local git commands and requires the repository be checked out!

name: "Pull Request Workflow"
on:
  pull_request:
      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: actions/checkout@v2
    - uses: dangoslen/changelog-enforcer@v2
      with:
        changeLogPath: 'CHANGELOG.md'
        skipLabels: 'Skip-Changelog'

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

  • Default: CHANGELOG.md
  • The path to your changelog file. Should be from the perspective of the root directory to git. The file being checked for updates must be either an add (A) or modified (M) status to git to qualify as updated.

skipLabels

  • Default: 'Skip-Changelog'

  • List of labels used to skip enforcing of the changelog during a pull request. Each label name is comma seperated and only one label needs to be present for enforcement to be skipped.

    For example, if label-1,label-2 was supplied as the skipLabels, label-1 or label-2 would skip the enforcer. Each label is trimmed for leading and trailing spaces since GitHub labels do not allow for leading or trailing spaces. Thus, the following lists are equivalent:

    • label-1,label-2
    • label-1 , label-2
    • label-1 ,label-2

missingUpdateErrorMessage

  • Default: ''
  • Custom error message to use when no update to the changelog is found.

expectedLatestVersion

  • Default: ''
  • The latest version of the software expected in the changelog. Should be in the form of v1.1.0, v3.5.6 etc.

versionPattern

  • Default: '## \\[((v|V)?\\d*\\.\\d*\\.\\d*-?\\w*|unreleased|Unreleased|UNRELEASED)\\]'
  • A regex pattern used to extract the versions from the changelog. Changelog Enforcer assumes the use of the KeepAChangelog.com convention, and as such looks for a line starting with ## [version] - date. Your regex should match the version as the 2nd match group. The regex pattern is used with global and multiline flags. Also note that since this is passed as a String, you will need to escape a backslash \ character via \\

Outputs

errorMessage

  • The reason for why the Changelog Enforcer failed. Uses the missingUpdateErrorMessage property value if set when no update to the changelog is found.

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.

changelog-enforcer's People

Contributors

dangoslen avatar dependabot[bot] avatar mathomp4 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.