Giter VIP home page Giter VIP logo

keep-a-changelog-merge's Introduction

Github Action: keep-a-changelog-merge

If you keep a changelog with git flow you're going to run into merge conflicts in CHANGELOG.md between your feature branches and your development branch. git merge is no help but this package is.

How to use Locally

CHANGELOG.md.default assumes this is a copy of the CHANGELOG that exists in the default branch repo, the CHANGELOG you want to merge into.

Node.js

npm install
node index.js --source ./CHANGELOG.md --destination ./CHANGELOG.md.default

Docker

docker build -t keep-a-changelog-merge . 
docker run \
    -v $(pwd)/test:/test \
    keep-a-changelog-merge \
    --source /test/CHANGELOG.md \
    --destination /test/CHANGELOG.md.default

How to use as a GitHub Action

name: Resolve Changelog.md conflicts

on:
  push:
    branches:
      - '**/**'
    paths:
      - 'CHANGELOG.md'

jobs:
  merge-changelog:
    name: "Resolve Changelog merge conflicts (if any)"
    runs-on: ubuntu:latest
    outputs:
      imageTag: ${{ steps.build.outputs.imageTag }}
    steps:
      - uses: actions/checkout@v2
        
      - name: Get a copy of the Remote branches Changelog
        run: |
          mv CHANGELOG.md CHANGELOG.md.tmp
          git checkout ${{ github.event.repository.default_branch }} -- CHANGELOG.md
          mv CHANGELOG.md CHANGELOG.md.remote
          mv CHANGELOG.tmp CHANGELOG.md
    
      - uses: pointivo/keep-a-changelog-merge

      - name: Initialize mandatory git config
        run: |
          git config user.name "GitHub actions"
          git config user.email [email protected]

      - name: Commit changelog if modified
        run: |
          if $(git ls-files --modified | grep CHANGELOG.md); then
            echo "Changelog modified"
            git add CHANGELOG.md
            git commit -m "Sync CHANGELOG with ${{ github.event.repository.default_branch }}. [skip ci]"
            git push origin release/${{ env.RELEASE_VERSION }}
          else 
            echo "Changelog not modified"
          fi

keep-a-changelog-merge's People

Contributors

nitrag avatar

Stargazers

 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.