for developers
Welcome
Boilerplates
Code Linting
Github Actions
Getting StartedLerna ReleasePull Request Changelog GeneratorBehaviorInstallationSemantic Release
Private Registry
Styled
🔒  Local Setup
🔒  Server Setup
🔒  Code Challenge

Pull Request Changelog Generator

A Github Action for generate a changelog, based on the merged pull request labels.

Behavior

On every v* tag pushed on the main branch:

  • Based on the merged pull request labels, a new changelog will be created.
  • A new Github release will be created.

Tag format

The tag must be respect the semver convention:

  • v10.2.31 ✅
  • v1.0.0 ✅
  • v1.0 ❌
  • v1 ❌

Installation

  • Add this to a .github/workflows/action.yml file:
name: Changelog Generator
on:
push:
tags:
- "v*"
jobs:
changelog:
name: Changelog
runs-on: ubuntu-18.04
steps:
- name: Check-out
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Generate release changelog
id: generate-release-changelog
uses: heinrichreimer/github-changelog-generator-action@v2.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
issues: true
issuesWoLabels: true
pullRequests: true
prWoLabels: true
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: npm version ${{ steps.previoustag.outputs.tag }} --git-tag-version false
- name: Commit updates
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Bump ${{ steps.previoustag.outputs.tag }} [skip-ci]
file_pattern: CHANGELOG.md package.json
release:
name: Release
runs-on: ubuntu-18.04
needs: changelog
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Get last changelog entry
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ steps.previoustag.outputs.tag }}
path: ./CHANGELOG.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changelog_reader.outputs.version }}
release_name: ${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
prerelease: ${{ steps.changelog_reader.outputs.status == 'prereleased' }}
draft: ${{ steps.changelog_reader.outputs.status == 'unreleased' }}