Skip to content

0.3.0

0.3.0 #13

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: |
{
echo "## [${{ steps.get_latest_release.outputs.tag }}] - $(date +"%Y-%m-%d")"
gh release view ${{ steps.get_latest_release.outputs.tag }} -R ${{ github.repository }} --json body --jq '.body'
echo ""
} >> new_entry.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Changelog.md at specific line
run: |
line_number=3
sed -i "${line_number}r new_entry.md" CHANGELOG.md
- name: Create new branch
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git checkout -b update-changelog-${{ steps.get_latest_release.outputs.tag }}
git add CHANGELOG.md
git commit -m 'Update CHANGELOG.md for ${{ steps.get_latest_release.outputs.tag }}'
git push -u origin update-changelog-${{ steps.get_latest_release.outputs.tag }}
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--title "Update CHANGELOG.md for ${{ steps.get_latest_release.outputs.tag }}" \
--body "This PR updates the CHANGELOG.md file with the release notes for ${{ steps.get_latest_release.outputs.tag }}." \
--head update-changelog-${{ steps.get_latest_release.outputs.tag }} \
--base main