-
Notifications
You must be signed in to change notification settings - Fork 5
42 lines (38 loc) · 1.27 KB
/
pr_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
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
branches:
- main
jobs:
check-changelog-updates:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for changelog
id: check-changelog
run: |
echo "count=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -c '^CHANGELOG.md$')" >> $GITHUB_OUTPUT
- name: Set comment body
id: comment-body
run: |
if ${{ steps.check-changelog.outputs.count == 0 }}; then
echo "content=❗ **CHANGELOG.md** has not been updated." >> $GITHUB_OUTPUT
else
echo "content=👍 Updated **CHANGELOG.md** found." >> $GITHUB_OUTPUT
fi
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
script: |
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{ steps.comment-body.outputs.content }}'
})