/reliable-changelog

A reliable commitlint based changelog generation action

Primary LanguageTypeScriptGNU Lesser General Public License v3.0LGPL-3.0

Version Badge License Badge

Reliable Changelog Action

A reliable action for generating changelogs for commitlint commits.

Features

  • Supports all @commitlint/config-angular commit prefixes.
  • Generates a clean changelog in markdown.
  • Automatically calculates the next version.
  • Creates a release tag for that version.
  • Customize the git commit message.
  • Customize the git username for action.
  • Can read current version from a .json file with a top level "version" property.
  • Customize the major version commit message (default is feat: major release).
  • Option to strip commit prefixes from generated changelog.
  • Limit types of commits used (default is feat, fix, and build).
  • Change what part of the version each commit type bumps.
  • Change the number of minor and patch commits needed to bump the version multiple times in one release.
  • Customize the labels for each commit section in the generated changelog.

Inputs

Below you can find a list of all input options, their default value, and a description of what they do.

Git Options

Name Default Description
github-token github.token The GitHub token used to authenticate when committing to GitHub. Default is the owner of the repository.
git-user-name Reliable Changelog Action The username used for commits created by the Action.
git-user-email reliable.changelog.action@github.com The email used for commits created by the Action.
git-commit-message chore(release): {version} The commit message used to push the changes made to any files by the Action. {version} will be replaced by the new version.
git-pull-method --ff-only The git pull method used when pulling changes.
git-branch ${{ github.ref }} The git branch to push and pull changes from. Default is the branch the Action is running on.
git-url github.com The git provider url.
tag-prefix v The prefix to use for the new tag created by the Action.

General Config

Name Default Description
current-version ./package.json The current version, or a relative path to a version file. Supported formats: json, toml, and yaml.
version-path version Path to the version property seperated by "."s. (Note: The version should be in the form X.X.X)
strip-commit-prefix true Whether to strip the commit prefix (ex: feat:) from entries in the changelog.
major-release-commit-message feat: major release The commit message used to trigger a major version bump (X.0.0). Must be prefixed with feat: (note the space).
included-types feat,fix,build A string of comma separated commit types to include. See @commitlint/config-angular for options.
minor-commit-types feat A string of comma separated commit types that will bump the minor version (0.X.0).
minor-commit-bump-interval 5 The number of minor commits in a single release needed to bump the version an additional time past 1.
patch-commit-types fix,build,docs,ci,perf,refactor,revert,style,test A string of comma separated commit types that will bump the patch version (0.0.X).
patch-commit-bump-interval 5 The number of patch commits in a single release needed to bump the version an additional time past 1.

Changelog Config

Name Default Description
feat-section-label New Features The header used for feat: commits.
fix-section-label Bug Fixes The header used for fix: commits.
build-section-label Build Pipeline Improvements The header used for build: commits.
docs-section-label Documentation Changes The header used for docs: commits.
ci-section-label CI Changes The header used for ci: commits.
perf-section-label Performance Improvements The header used for pref: commits.
refactor-section-label Refactoring The header used for refactor: commits.
revert-section-label Reverted Changes The header used for revert: commits.
style-section-label Styling Changes The header used for style: commits.
test-section-label Testing Changes The header used for test: commits.

Outputs

Name Description
changelog The markdown changelog generated by the Action.
tag The tag for the new version generated by the Action.
version The new version generated by the Action.

Example

Below is an example of a GitHub Action using reliable-changelog.

name: Release

on:
  push:
    branches:
      - "release"

jobs:
  create-release:
    permissions:
      contents: write
    runs-on: ubuntu-20.04
    outputs:
      release_id: ${{ steps.create-release.outputs.result }}
      # These are here so later jobs can have access to the reliable-changelog outputs.
      change_log: ${{ steps.changelog.outputs.changelog }}
      version: ${{ steps.changelog.outputs.version }}
      tag: ${{ steps.changelog.outputs.tag }}

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3

      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 16

      - name: Conventional Changelog Action
        id: changelog
        uses: Tormak9970/reliable-changelog@v1
        with:
          github-token: ${{ secrets.github_token }}
          patch-version-bump-interval: 10

      - name: Create Release
        id: create-release
        uses: actions/github-script@v6
        env:
          RELEASE_TAG: ${{ steps.changelog.outputs.tag }}
          RELEASE_LOG: ${{ steps.changelog.outputs.clean_changelog }}
        with:
          script: |
            const { data } = await github.rest.repos.createRelease({
              owner: context.repo.owner,
              repo: context.repo.repo,
              tag_name: `${process.env.RELEASE_TAG}`,
              name: `Steam Art Manager ${process.env.RELEASE_TAG}`,
              body: `${process.env.RELEASE_LOG}`,
              draft: true,
              prerelease: false
            });
            return data.id

Licensing

Copyright Travis Lane (Tormak)