-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (39 loc) · 1.56 KB
/
update-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: Update changelog
on:
workflow_call:
secrets:
CHECKOUT_ACTION_TOKEN:
required: true
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# Fetch entire history of repository to ensure relase date can be
# extracted from commit of the given tag.
fetch-depth: 0
# Checkout target branch of this release. Ensures that the CHANGELOG
# is not out of date.
ref: ${{ github.event.release.target_commitish }}
token: ${{ secrets.CHECKOUT_ACTION_TOKEN }}
- name: Extract release date from git tag
id: release_date
run: |
echo "::set-output name=date::$(git log -1 --date=short --format=%ad '${{ github.event.release.tag_name }}')"
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
# Pass extracted release date, release notes and version to the Action.
release-date: ${{ steps.release_date.outputs.date }}
release-notes: ${{ github.event.release.body }}
latest-version: ${{ github.event.release.tag_name }}
compare-url-target-revision: ${{ github.event.release.target_commitish }}
- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
with:
# Push updated CHANGELOG to release target branch.
branch: ${{ github.event.release.target_commitish }}
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md