Feat(ci): fix changelog workflow #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Changelog Update | |
on: | |
pull_request: | |
branches: | |
- main | |
types: [opened, synchronize, reopened] | |
permissions: write-all | |
jobs: | |
update_changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Install conventional-changelog-cli | |
run: npm install -g conventional-changelog-cli | |
- name: Generate changelog diff | |
run: | | |
echo "Pull Request Title: ${{ github.event.pull_request.title }}" | |
echo "Pull Request Body: ${{ github.event.pull_request.body }}" | |
conventional-changelog -p angular -i CHANGELOG.md -s -r 0 | |
git diff CHANGELOG.md > changelog_diff.md | |
cat changelog_diff.md | |
- name: Commit and push changelog update | |
run: | | |
git config user.name 'github-actions' | |
git config user.email '[email protected]' | |
git add CHANGELOG.md | |
git commit -m "Update CHANGELOG.md based on PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}" | |
git push origin HEAD:refs/heads/${{ github.head_ref }} |