fruivita/corporate

View on GitHub
.github/workflows/update-changelog.yml

Summary

Maintainability
Test Coverage
###############################################################################
# About GitHub Actions                                                        #
# https://docs.github.com/en/actions/learn-github-actions                     #
# https://www.youtube.com/watch?v=TLB5MY9BBa4                                 #
###############################################################################
#
# Automatically updates the changelog file whenever there is a release
#
# Motivation: https://stefanzweifel.io/posts/2021/11/13/introducing-the-changelog-updater-action
# How to use: https://github.com/stefanzweifel/changelog-updater-action
# See: https://docs.github.com/pt/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow

name: Update Changelog

on:
  workflow_call:
  release:
    types: [released]

jobs:
  update:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          ref: ${{ github.ref_name }}

      - name: Update Changelog
        uses: stefanzweifel/changelog-updater-action@v1
        with:
          latest-version: ${{ github.event.release.tag_name }}
          release-notes: ${{ github.event.release.body }}
          path-to-changelog: docs/CHANGELOG.md
          compare-url-target-revision: ${{ github.event.release.target_commitish }}

      - name: Auto Commit
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          branch: ${{ github.event.release.target_commitish }}
          commit_message: 'docs: update changelog.md'
          file_pattern: docs/CHANGELOG.md