-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (53 loc) · 1.81 KB
/
pr-check-commit-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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: PR Changelog
on:
pull_request:
types:
- opened
- reopened
- synchronize
- edited
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
check:
name: Preview
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install git-cliff
uses: baptiste0928/cargo-install@v2
with:
crate: git-cliff
git: https://github.com/AaronFriel/git-cliff
commit: 702c79236ef0b0a3d2430f73902db3339933fbfd
- name: Changelog
id: changelog
env:
PR_BODY: ${{ github.event.pull_request.body }}
run:
PREVIOUS_VERSION="${{ github.event.pull_request.base.sha }}"
CHANGELOG_REQUIRED="${{ !contains(github.event.pull_request.labels.*.name, 'impact/no-changelog-required') }}"
CHANGELOG="$(./.github/scripts/get-changelog-comment "${PREVIOUS_VERSION}" "${CHANGELOG_REQUIRED}" "${PR_BODY}")"
./.github/scripts/set-output CHANGELOG "${CHANGELOG}"
- name: Find Comment
uses: peter-evans/find-comment@1769778a0c5bd330272d749d12c036d65e70d39d # v2.0.0
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: "# Changelog"
- name: Create or update comment
uses: peter-evans/create-or-update-comment@c9fcb64660bc90ec1cc535646af190c992007c32 # v2.0.0
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
# Changelog
${{ fromJSON(steps.changelog.outputs.CHANGELOG) }}
edit-mode: replace