-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (40 loc) · 1.42 KB
/
changelog_test.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 Check
on:
pull_request:
types:
- opened
- synchronize
jobs:
changelog-check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check for CHANGELOG.md update
id: changelog-check
run: |
if ! grep -q "CHANGELOG.md" <<< "${{ github.event.pull_request.changed_files }}"; then
echo "Each PR must include an update to the CHANGELOG.md file."
echo "::set-output name=comment::Each PR must include an update to the CHANGELOG.md file."
else
echo "CHANGELOG.md update found."
fi
- name: Comment on PR
if: steps.changelog-check.outputs.comment
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const comment = core.getInput('comment');
const response = await github.rest.pulls.list({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
head: `${github.context.repo.owner}:${github.event.pull_request.head.ref}`,
});
const prNumber = response.data[0].number;
await github.rest.issues.createComment({
issue_number: prNumber,
owner: github.context.repo.owner,
repo: github.context.repo.repo,
body: comment
});