You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/validate_pr.yml
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -23,3 +23,27 @@ jobs:
23
23
}
24
24
25
25
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 = context.payload.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
+
const errorMessage = "PR description validation failed. The description must contain a line matching the case-insensitive pattern: 'pulled in by https://github.com/OffchainLabs/nitro/pull/xxxx', where 'xxxx' is a number.";
46
+
core.setFailed(errorMessage);
47
+
} else {
48
+
core.info("✅ PR description contains the required link.");
0 commit comments