-
Notifications
You must be signed in to change notification settings - Fork 349
45 lines (37 loc) · 1.31 KB
/
changelog.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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@v2
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18"
- name: Install conventional-changelog-cli
run: npm install -g conventional-changelog-cli
- name: Get PR title
id: pr_title
run: echo "::set-output name=title::$(jq --raw-output .pull_request.title $GITHUB_EVENT_PATH)"
- name: Generate changelog diff
run: |
git fetch origin main:main
conventional-changelog -p angular -i CHANGELOG.md -s -r 0 > changelog_diff.md
echo "### ${GITHUB_REF##*/} - ${{ steps.pr_title.outputs.title }}" >> changelog_diff.md
echo "::set-output name=changelog::$(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 [skip ci]"
git push origin HEAD:refs/heads/${{ github.head_ref }}