5
5
types :
6
6
- opened
7
7
- synchronize
8
+ - reopened
8
9
9
10
jobs :
10
11
changelog-check :
@@ -20,26 +21,14 @@ jobs:
20
21
if ! grep -q "CHANGELOG.md" <<< "${{ github.event.pull_request.changed_files }}"; then
21
22
echo "Each PR must include an update to the CHANGELOG.md file."
22
23
echo "::set-output name=comment::Each PR must include an update to the CHANGELOG.md file."
24
+ echo "::set-output name=changelog-updated::false"
23
25
else
24
26
echo "CHANGELOG.md update found."
27
+ echo "::set-output name=changelog-updated::true"
25
28
fi
26
29
27
- - name : Comment on PR
28
- if : steps.changelog-check.outputs.comment
29
- uses : actions/github-script@v4
30
- with :
31
- github-token : ${{ secrets.GITHUB_TOKEN }}
32
- script : |
33
- const comment = core.getInput('comment');
34
- const response = await github.rest.pulls.list({
35
- owner: github.context.repo.owner,
36
- repo: github.context.repo.repo,
37
- head: `${github.context.repo.owner}:${github.event.pull_request.head.ref}`,
38
- });
39
- const prNumber = response.data[0].number;
40
- await github.rest.issues.createComment({
41
- issue_number: prNumber,
42
- owner: github.context.repo.owner,
43
- repo: github.context.repo.repo,
44
- body: comment
45
- });
30
+ - name : Prevent PR merge if CHANGELOG.md is not updated
31
+ if : steps.changelog-check.outputs.changelog-updated == 'false'
32
+ run : |
33
+ echo "The CHANGELOG.md file must be updated before merging."
34
+ exit 1
0 commit comments