Skip to content

Update Changelog file #3

Update Changelog file

Update Changelog file #3

name: Update Changelog file
on:
workflow_dispatch:
release:
types: [published]
jobs:
update-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get latest release tag
id: get_latest_release
run: echo "::set-output name=tag::$(gh release list -R ${{ github.repository }} --limit 1 --json tagName --jq '.[0].tagName')"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get release notes
id: get_release_notes
run: |
release_notes=$(gh release view ${{ steps.get_latest_release.outputs.tag }} -R ${{ github.repository }} --json body --jq '.body')
echo "::set-output name=notes::$release_notes"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update CHANGELOG.md
run: |
echo "## [${{ steps.get_latest_release.outputs.tag }}] - $(date +"%Y-%m-%d")" >> CHANGELOG.md
echo "${{ steps.get_release_notes.outputs.notes }}" >> CHANGELOG.md
echo "" >> CHANGELOG.md
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add CHANGELOG.md
git commit -m 'Update CHANGELOG.md for ${{ steps.get_latest_release.outputs.tag }}'
git push origin HEAD:${{ github.ref }}