Git Product home page Git Product logo

github-add-changelog-action's Introduction

Pull request changelog entries action Tests

A GitHub actions that:

  1. Extracts changelog entries from a pull request body
  2. Adds the changelog entries to the CHANGELOG.md after merge

Avoiding changelog merge conflicts

At Vendic every pull request needs a change in CHANGELOG.md. We follow the keep a changelog format. It costs a lot of time to fix the merge conflicts that come from mulltiple pull requests that are modifying the changelog.

After a lengthy internal discussion, we had the idea that we could extract the changelog entries (using regular expressions) from the pull request body after the PR is merged. Next, we would add it to the CHANGELOG.md using a NodeJS keep a changelog library and some git actions.

This repo is a result of that idea and it contains the workflows that you need to work with changelogs merge conflict-free.

Usage

Internally we are using a pull request template so that the pull requests are consistent:

## Description
<!-- Please include a summary of the changes and the related issue. Please also include relevant context. -->

## How Has This Been Tested?
<!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration -->

## Changelog
<!-- Available topics: Added, Changed, Deprecated, Removed, Fixed, Security -->
### Changed
<!-- Add bullet list of changes here -->

### Fixed
<!-- Add bullet list of fixes here -->

Actions workflow:

name: Modify changelog

on:
  pull_request:
    types: [ closed ]

jobs:
  modify_changelog:
    name: Modify changelog
    if: ${{ github.event.pull_request.merged == true }}
    runs-on: ubuntu
    steps:
      - name: Extract changelog entries from PR body and modify CHANGELOG.md
        uses: Vendic/github-add-changelog-action@develop
        with:
          committer_username: "YourUserName"
          committer_email: [email protected]
          token: ${{ secrets.YOUR_GITHUB_TOKEN }}

In addition to that we also check if every pull request body contains a Changelog section:

name: Pull request actions

on:
  pull_request:
    types: [ opened, synchronize ]

jobs:
  check_changelog_message:
    name: Check changelog message
    runs-on: ubuntu
    steps:
      - name: Chck if PR body contains changelog entries
        run: |
          echo "${{ github.event.pull_request.body }}" | grep "## Changelog"

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.