-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (37 loc) · 1.45 KB
/
check_pr_release_note_comment.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
name: Check Release Notes in PR comment
on:
pull_request:
types: [opened, synchronize, reopened, edited, labeled, unlabeled]
branches: [ master ]
jobs:
check-release-notes-comments:
runs-on: ubuntu-latest
steps:
- name: Fetch all PR comments
id: get-comments
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issueNumber = context.issue.number;
const repoName = context.repo.repo;
const repoOwner = context.repo.owner;
const comments = await github.rest.issues.listComments({
owner: repoOwner,
repo: repoName,
issue_number: issueNumber,
});
return comments.data.map(comment => comment.body);
- name: Check for 'Release Notes' in comments
uses: actions/github-script@v7
with:
script: |
const comments = ${{ steps.get-comments.outputs.result }};
const releaseNotesRegex = /release notes/i;
const hasReleaseNotes = comments.some(comment => releaseNotesRegex.test(comment));
if (!hasReleaseNotes) {
console.log('No "Release notes" found in PR comments');
core.setFailed('No "Release notes" found in PR comments')
} else {
console.log('"Release notes" found in comments');
}