Skip to content

Commit e9aa0da

Browse files
Add PR description check
1 parent f1a53d4 commit e9aa0da

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/validate_pr.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,32 @@ jobs:
2323
}
2424
2525
console.log('✅ PR title format is valid');
26+
27+
- name: Ensure PR Has a Nitro Companion
28+
uses: actions/github-script@v7
29+
with:
30+
script: |
31+
const prBody = github.event.pull_request.body;
32+
33+
if (!prBody) {
34+
core.setFailed("The PR description is empty. Please ensure it contains the required link.");
35+
return;
36+
}
37+
38+
// The required regex pattern:
39+
// 1. Matches the literal string "pulled in by https://github.com/OffchainLabs/nitro/pull/"
40+
// 2. Requires one or more digits (\d+) for the pull request number (xxxx)
41+
// 3. The 'i' flag makes the entire match case-insensitive (e.g., "Pulled In By" is valid)
42+
const requiredRegex = /pulled in by https:\/\/github\.com\/OffchainLabs\/nitro\/pull\/\d+/i;
43+
44+
if (!requiredRegex.test(prBody)) {
45+
core.setFailed(
46+
`PR description validation failed.
47+
48+
The description must contain a line matching the case-insensitive pattern:
49+
'pulled in by https://github.com/OffchainLabs/nitro/pull/xxxx',
50+
where 'xxxx' is a number.`
51+
);
52+
} else {
53+
core.info("✅ PR description contains the required link.");
54+

0 commit comments

Comments
 (0)