-
Notifications
You must be signed in to change notification settings - Fork 6.7k
34 lines (30 loc) · 1.29 KB
/
Copy pathcheck-pr-manual-test.yml
File metadata and controls
34 lines (30 loc) · 1.29 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
name: "CI: Check Manual Test Completion"
on:
pull_request:
types: [opened, edited, synchronize]
jobs:
check-task:
runs-on: ubuntu-latest
steps:
- name: Verify tests checkbox is ticked
uses: actions/github-script@v7
with:
script: |
const prBody = context.payload.pull_request.body;
if (!prBody) {
core.setFailed("PR description is empty. Please use the PR template and check the required boxes.");
return;
}
// Regex checks for a markdown checkbox followed by 'nox -s py-3.'
// [ x ] or [x] means checked. [ ] means unchecked.
const checkedRegex = /- \[[xX]\] .*nox -s py-3\.\d+/;
const includesTargetText = prBody.includes("nox -s py-3.");
if (!includesTargetText) {
core.setFailed("The required test verification line seems to be missing from the PR description.");
return;
}
if (checkedRegex.test(prBody)) {
console.log("Success: The test execution checkbox has been marked!");
} else {
core.setFailed("You must run the tests and check the 'nox -s py-3.9' box before this PR can be merged.");
}