From 87ad709e5eccfda91f95bf73ce8b563518cf1f30 Mon Sep 17 00:00:00 2001 From: bcakmakoglu <78412429+bcakmakoglu@users.noreply.github.com> Date: Wed, 15 Jun 2022 19:59:08 +0200 Subject: [PATCH] chore: add workflow to generate changelog on `v*`-tags push --- .github/workflows/changelog.yml | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index fe61a961..aa4cd89b 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -1,33 +1,33 @@ -name: Generate changelog - -on: workflow_dispatch +on: + push: + tags: + - 'v*' jobs: - generate-changelog: + changelog: name: Generate changelog - runs-on: ubuntu-20.04 - outputs: - release_body: ${{ steps.release.outputs.release_body }} + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 0 + - name: Generate a changelog uses: orhun/git-cliff-action@v1 id: git-cliff with: config: cliff.toml - args: --output CHANGELOG.md + args: --verbose env: OUTPUT: CHANGELOG.md - - name: Set the release body - id: release - shell: bash - run: | - r=$(cat ${{ steps.git-cliff.outputs.changelog }}) - r="$(printf "$r" | tail -n +3)" - r="${r//'%'/'%25'}" - r="${r//$'\n'/'%0A'}" - r="${r//$'\r'/'%0D'}" - echo "::set-output name=release_body::$r" + + - name: Commit the changelog + uses: EndBug/add-and-commit@v9 + with: + add: 'CHANGELOG.md' + author_name: Git Cliff + committer_name: Git Cliff + message: 'chore: update CHANGELOG.md'