fruivita/corporativo

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

Summary

Maintainability
Test Coverage
###############################################################################
# Sobre o GitHub Actions                                                      #
# https://docs.github.com/en/actions/learn-github-actions                     #
# https://www.youtube.com/watch?v=TLB5MY9BBa4                                 #
###############################################################################
#
# Automaticamente atualiza o arquivo changelog sempre que houver um release
#
# Motivação: https://stefanzweifel.io/posts/2021/11/13/introducing-the-changelog-updater-action
# Como usar: https://github.com/stefanzweifel/changelog-updater-action
# Veja: 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