Skip to content

Add configurable PR template section validation - #136

Merged
jeffpaul merged 1 commit into
developfrom
feature/configurable-pr-template-sections
Jun 29, 2026
Merged

Add configurable PR template section validation#136
jeffpaul merged 1 commit into
developfrom
feature/configurable-pr-template-sections

Conversation

@jeffpaul

Copy link
Copy Markdown
Member

Description of the Change

Introduces a new validate-pr-template-sections input that accepts a multiline list of PR template section headings to require non-empty content under. This allows repositories with custom PR templates to validate that specific sections have been filled out, without being tied to the hardcoded Description of the Change, Changelog, and Credits headings used by the existing validation inputs.

Key behaviors:

  • Heading level is ignored — What?, ## Why?, and ### Use of AI Tools all match the same heading text
  • Content consisting only of whitespace or blockquote lines (> ...) is treated as empty, handling placeholder examples common in PR templates
  • Each failing section produces a distinct error message
  • Fully backward compatible — existing validate-description, validate-changelog, and validate-credits inputs are unchanged
  • Also updates the default comment-template wording to be generic rather than referencing 10up-specific section names

Changelog

Added - New validate-pr-template-sections input for configurable PR template section validation.

Credits

@jeffpaul

Introduces a new `validate-pr-template-sections` input that accepts a
multiline list of section heading names to require non-empty content
under. Heading level is ignored so any `#`-level heading matches.
Content consisting only of blockquote lines (placeholder examples) is
treated as empty. Existing `validate-description`, `validate-changelog`,
and `validate-credits` inputs are unchanged.

Also updates the default `comment-template` wording to be generic rather
than referencing 10up-specific section names.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jeffpaul
jeffpaul requested a review from iamdharmesh as a code owner June 26, 2026 22:19
@github-actions github-actions Bot added this to the 2.2.0 milestone Jun 26, 2026
@github-actions github-actions Bot added the needs:code-review This requires code review. label Jun 26, 2026
@jeffpaul
jeffpaul requested a review from dkotter June 26, 2026 22:20
@jeffpaul

Copy link
Copy Markdown
Member Author

Note that this was crafted to help with cases where repos using this have drastically different PR templates (ex. WordPress/ai#765).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a configurable mechanism to validate that specific PR template sections are filled out, via a new validate-pr-template-sections action input, while keeping existing hardcoded validations intact.

Changes:

  • Add validate-pr-template-sections input parsing and wire it into PR validation.
  • Introduce a getSectionContent() helper to extract and evaluate content under an arbitrary heading.
  • Update default comment-template wording and document the new input in the README.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/utils.js Adds multiline input parsing for required headings and introduces getSectionContent() for extracting section body text.
src/pr-validation.js Runs per-section validation using the new input and helper, emitting a distinct error per missing section.
README.md Documents the new input and provides usage guidance/examples.
action.yml Declares the new validate-pr-template-sections input and updates the default comment template.
dist/index.js Updates the bundled distribution output to include the new input/validation logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils.js
Comment thread src/utils.js
Comment thread src/pr-validation.js

@iamdharmesh iamdharmesh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @jeffpaul. This looks great :shipit:

@jeffpaul
jeffpaul merged commit 5164976 into develop Jun 29, 2026
3 checks passed
@jeffpaul
jeffpaul deleted the feature/configurable-pr-template-sections branch June 29, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:code-review This requires code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants