forked from openvinotoolkit/model_analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (26 loc) · 1.02 KB
/
check-pr-name.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
name: "Check Pull Request Name"
on: [pull_request, push]
jobs:
pr-name-check:
name: Check Pull Request Name
runs-on: ubuntu-20.04
if: github.event_name == 'pull_request'
steps:
- name: Compare PR Name to the Template
uses: actions/github-script@v5
with:
script: |
const prNameRegExp = /^(?:\[\d+\]\s?)+\w+.*/;
const skipLabel = '[skip-name]';
const prName = context.payload.pull_request.title;
console.log(`Pull Request Name is ${prName}`);
if (prName.includes(skipLabel)) {
console.log('Skipping PR name checks');
return;
}
if (!prNameRegExp.test(prName)) {
console.log('Template: [issue_number] ([another_issue_number] ...) Short description');
core.setFailed('Your Pull Request title does not confirm to the template');
return;
}
console.log('Your Pull Request name confirm to the provided template');