Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 12 additions & 21 deletions .github/workflows/pr-message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,28 +74,19 @@ jobs:
return;
}

if (body.length > 0) {
const invalidLines = body
.split("\n")
.map((line, index) => ({ line, number: index + 1 }))
.filter(({ line }) => !/^- .+/.test(line));
const conflictMarkerRe =
/^<{7}(?: .*)?$[\s\S]*^={7}$[\s\S]*^>{7}(?: .*)?$/m;

if (invalidLines.length > 0) {
core.setFailed(
[
"Invalid PR body.",
"",
'If PR body is present, every line must start with "- ".',
"Blank lines are not allowed.",
"",
"Invalid lines:",
...invalidLines.map(
({ number, line }) => ` line ${number}: ${line || "<blank line>"}`
),
].join("\n")
);
return;
}
if (conflictMarkerRe.test(body)) {
core.setFailed(
[
"Invalid PR body.",
"",
"The body appears to contain unresolved merge conflict markers.",
"Please resolve the conflict markers before opening or updating the PR.",
].join("\n")
);
return;
}

core.info("PR title and body look good.");
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ make release
## Git And PRs

- Use Conventional Commits for commit messages and PR titles.
- Keep PR bodies compatible with `.github/workflows/pr-message.yml`: each line starts with `- `, no blank lines, no `Co-authored-by:` trailers.
- Keep PR bodies compatible with `.github/workflows/pr-message.yml`: use concise GitHub Markdown, and do not include `Co-authored-by:` trailers or unresolved conflict markers.
- Keep PR bodies short and focused on summary, validation, impact, related issues, and notes.
- Check PR CI before requesting review or merge.

Expand Down
Loading