Skip to content

✨ feat(body): support optional PR template sections - #11

Merged
zrr1999 merged 4 commits into
mainfrom
feat/pr-body-section-requirements
Aug 7, 2026
Merged

✨ feat(body): support optional PR template sections#11
zrr1999 merged 4 commits into
mainfrom
feat/pr-body-section-requirements

Conversation

@zrr1999

@zrr1999 zrr1999 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add requirement-aware PR-body template parsing while preserving the existing required-by-default behavior.

  • treat every unmarked H2 in the repository PR template as required;
  • allow <!-- pr-body:optional --> before an H2 to make only that section optional;
  • accept <!-- pr-body:required --> for explicitness without changing the default;
  • require present sections to remain in template order and reject undeclared or duplicate H2 headings;
  • fail closed on duplicate template headings, multiple directives for one section, or dangling directives;
  • ignore headings and directives inside fenced code blocks;
  • keep the existing checklist validation independent of section optionality;
  • document the marker contract in the composite action and README.

Existing templates without directives retain their current exact required-heading behavior.

Validation

  • extended tests/test_body_cli.py with required-by-default, optional omission/presence, ordering, duplicate/extra heading, fenced directive, invalid-template, and CLI cases;
  • repository CI is expected to run formatting, lint/type checks, and the complete pytest suite on this Draft PR.

Notes

This is a backward-compatible validator capability. It does not change zendev's own PR template in this PR; consuming repositories can adopt optional sections independently after this lands.

@zrr1999
zrr1999 marked this pull request as ready for review August 7, 2026 02:38
@zrr1999
zrr1999 merged commit 344af12 into main Aug 7, 2026
4 checks passed
@zrr1999
zrr1999 deleted the feat/pr-body-section-requirements branch August 7, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant