Skip to content

feat(create-pr): detect and use PR template when present - #551

Merged
baleen37 merged 1 commit into
mainfrom
feat/pr-template-support
Mar 13, 2026
Merged

feat(create-pr): detect and use PR template when present#551
baleen37 merged 1 commit into
mainfrom
feat/pr-template-support

Conversation

@baleen37

@baleen37 baleen37 commented Mar 13, 2026

Copy link
Copy Markdown
Owner

Summary

Add PR template detection to the create-pr skill. When a project defines a standard PR template, the skill now uses it instead of the hardcoded default format.

Changes

  • Added step 5 to detect PR templates in .github/PULL_REQUEST_TEMPLATE.md or PULL_REQUEST_TEMPLATE.md
  • Updated PR creation step to use filled template body or fall back to default format
  • Split "PR Body Format" section into two cases: template found vs. not found
  • Empty checkboxes (- [ ]) in templates are preserved as-is
  • Renumbered subsequent steps (verify → 7, auto-merge → 8)

Tests

Verified SKILL.md reads correctly with updated workflow and PR Body Format section.

Breaking

None.

Summary by CodeRabbit

  • Documentation
    • Improved PR creation workflow documentation with enhanced template support. The process now detects and uses available PR templates, automatically populates sections with changes, and preserves formatting. Includes fallback guidance when no template exists and clearer instructions for composing PR bodies.

@coderabbitai

coderabbitai Bot commented Mar 13, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Updates documentation for the PR creation workflow to detect and use PR templates when available, with sections filled from actual changes and fallback to default format if no template is found. Step sequencing adjusted accordingly.

Changes

Cohort / File(s) Summary
Documentation Updates
plugins/me/skills/create-pr/SKILL.md
Refines PR creation workflow documentation to include PR template detection logic, conditional formatting based on template availability, and updated step sequencing for template detection, PR creation, verification, and optional auto-merge.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 Template detection, oh what a sight!
Workflows now polished, all shiny and bright,
Branches and PRs, step by step they align,
A rabbit's delight in docs so divine! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding PR template detection to the create-pr skill.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/pr-template-support
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can enable review details to help with troubleshooting, context usage and more.

Enable the reviews.review_details setting to include review details such as the model used, the time taken for each step and more in the review comments.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@plugins/me/skills/create-pr/SKILL.md`:
- Around line 38-41: Update the "detect PR template (check in order)"
documentation to list all GitHub-supported template locations and behaviors:
check for templates in both top-level and .github directories, support dedicated
template directories (e.g., PULL_REQUEST_TEMPLATE/ and
.github/PULL_REQUEST_TEMPLATE/) and multiple templates within subdirectories,
and note that filenames are case-insensitive; also mirror this change where "PR
Body Format" is documented so both sections reflect the same discovery order and
case-insensitivity.
- Around line 43-46: The current PR creation uses an inline --body "<filled
body>" which breaks on multiline/markdown content; update the PR creation step
that sets PR_URL via the gh pr create invocation to pass the body via
--body-file (either write the filled template to a temporary file and pass its
path, or stream it via --body-file -) instead of --body, ensuring the command
handles multiline markdown, quotes, and backticks robustly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1490f43c-e0ec-4c88-81b5-94c4eafda130

📥 Commits

Reviewing files that changed from the base of the PR and between fe2d45e and 8b5c9be.

📒 Files selected for processing (1)
  • plugins/me/skills/create-pr/SKILL.md

Comment on lines +38 to +41
# 5) detect PR template (check in order)
# .github/PULL_REQUEST_TEMPLATE.md → PULL_REQUEST_TEMPLATE.md → default format
# If found: read it, fill each section with actual change details, preserve empty checkboxes (- [ ]) as-is
# If not found: use default format (see PR Body Format below)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

What file locations and naming patterns does GitHub currently support for pull request templates (single and multiple templates)?

💡 Result:

Single pull request template (auto-applied)

GitHub will use a single default PR template if you add one of these files (filenames are not case sensitive) on the repository’s default branch:

  • pull_request_template.md (repository root) [1]
  • docs/pull_request_template.md [1]
  • .github/pull_request_template.md [1]

PR template files are not case sensitive and can use extensions like .md or .txt. [2]

Multiple pull request templates (select via URL parameter)

GitHub supports multiple PR templates by placing template files in a PULL_REQUEST_TEMPLATE/ subdirectory (on the default branch) under any of these locations:

  • PULL_REQUEST_TEMPLATE/<template-file> (repository root) [1]
  • docs/PULL_REQUEST_TEMPLATE/<template-file> [1]
  • .github/PULL_REQUEST_TEMPLATE/<template-file> [1]

To use a specific one, pass its filename via the template query parameter when opening a PR, e.g. ...&template=<template-file>. The template parameter works with templates stored in those PULL_REQUEST_TEMPLATE subdirectories. [3]

Example path (from GitHub docs): .github/PULL_REQUEST_TEMPLATE/pull_request_template.md [1]

Sources: [1] GitHub Docs (Creating a pull request template) (docs.github.com), [2] GitHub Docs (About issue and pull request templates) (docs.github.com), [3] GitHub Docs (Using query parameters to create a pull request) (docs.github.com)

Citations:


Broaden PR template discovery to match GitHub-supported locations.

The current documentation (lines 38–41 and 67–71) documents only .github/PULL_REQUEST_TEMPLATE.md and PULL_REQUEST_TEMPLATE.md, which omits valid template locations supported by GitHub. Additionally, GitHub treats template filenames as case-insensitive and supports multiple templates via subdirectories.

Suggested documentation update
-# .github/PULL_REQUEST_TEMPLATE.md → PULL_REQUEST_TEMPLATE.md → default format
+# GitHub searches in order (case-insensitive):
+# .github/PULL_REQUEST_TEMPLATE/*.md (multiple templates)
+# .github/pull_request_template.md (single template)
+# PULL_REQUEST_TEMPLATE/*.md (multiple templates, repo root)
+# pull_request_template.md (single template, repo root)
+# docs/PULL_REQUEST_TEMPLATE/*.md (multiple templates)
+# docs/pull_request_template.md (single template)
+# Then: default format

Also applies to: 67–71

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/me/skills/create-pr/SKILL.md` around lines 38 - 41, Update the
"detect PR template (check in order)" documentation to list all GitHub-supported
template locations and behaviors: check for templates in both top-level and
.github directories, support dedicated template directories (e.g.,
PULL_REQUEST_TEMPLATE/ and .github/PULL_REQUEST_TEMPLATE/) and multiple
templates within subdirectories, and note that filenames are case-insensitive;
also mirror this change where "PR Body Format" is documented so both sections
reflect the same discovery order and case-insensitivity.

Comment on lines +43 to +46
# 6) create PR (do not hardcode --base main)
# Body: filled template or default format
PR_URL=$(gh pr create --title "$(git log -1 --pretty=%s)" --body "<filled body>")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

In GitHub CLI (gh pr create), what is the recommended way to pass multiline PR body content safely: --bodyor--body-file?

💡 Result:

Use --body-file (or --body-file - to read from stdin) for multiline PR bodies; it avoids fragile shell quoting/escaping that you’d hit trying to cram newlines into --body. [1], [2]

Example (heredoc):

gh pr create --title "My PR" --body-file - <<'EOF'
Line 1

Line 2
- Bullet
EOF

Sources: [1] GitHub CLI manual: gh pr create (--body-file reads from file / - stdin). [2] Example using --body-file - for multiline input.


Use --body-file instead of inline --body for filled templates.

Line 45's inline --body "<filled body>" is fragile for multiline markdown, quotes, and backticks from real templates. Pass PR body content via --body-file (reading from a temp file or stdin with --body-file -):

Suggested pattern
-PR_URL=$(gh pr create --title "$(git log -1 --pretty=%s)" --body "<filled body>")
+PR_URL=$(gh pr create --title "$(git log -1 --pretty=%s)" --body-file "$TMP_PR_BODY_FILE")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/me/skills/create-pr/SKILL.md` around lines 43 - 46, The current PR
creation uses an inline --body "<filled body>" which breaks on
multiline/markdown content; update the PR creation step that sets PR_URL via the
gh pr create invocation to pass the body via --body-file (either write the
filled template to a temporary file and pass its path, or stream it via
--body-file -) instead of --body, ensuring the command handles multiline
markdown, quotes, and backticks robustly.

@baleen37
baleen37 merged commit 014dbd1 into main Mar 13, 2026
5 checks passed
@baleen37
baleen37 deleted the feat/pr-template-support branch March 13, 2026 08:30
baleen-release-app Bot pushed a commit that referenced this pull request Mar 13, 2026
# [5.43.0](v5.42.2...v5.43.0) (2026-03-13)

### Features

* **create-pr:** detect and use PR template when present ([#551](#551)) ([014dbd1](014dbd1))
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