-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (39 loc) · 1.36 KB
/
Copy pathpull_request_check.yml
File metadata and controls
44 lines (39 loc) · 1.36 KB
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
name: Verify changed code on pull request
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check_changelog:
name: Check for changelog updates
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 20.11.1 LTS version
uses: actions/setup-node@v2
with:
node-version: 22.16.0
- name: Check for changelog updates
uses: actions/github-script@v7
with:
script: |
const prNumber = context.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const getChangedFiles = await github.rest.pulls.listFiles({
owner,
repo,
pull_number: prNumber
});
const changelogUpdated = getChangedFiles.data.find(file => file.filename === 'CHANGELOG.md');
if (!changelogUpdated) {
await github.rest.issues.createComment({
owner,
repo,
issue_number: prNumber,
body: ':warning: **CHANGELOG.md was not updated. Please update it before merging the PR.**'
});
core.warning('CHANGELOG.md was not updated. Please update it before merging the PR!');
}