feat: branch-aware-pr-templates#8
Merged
Merged
Conversation
Resolve PR body templates by branch type, most-specific first: branch-specific -> group -> bflow default -> git default. Templates live in .github/pr-templates/bflow-<key>.md. The "group" layer reuses the conventional-commit type bflow already computes, so the fix family (fix, release-fix, hotfix-fix) shares bflow-fix.md with no config file and no new dependency. Opt-in: with no pr-templates dir, existing git-default behavior is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
There was a problem hiding this comment.
Pull request overview
Adds branch-aware PR template resolution. When bflow finish opens a PR, it now looks up a template under .github/pr-templates/bflow-<key>.md using a most-specific → group → default order, and passes the resolved path to the hosting layer (which falls back to existing git/GitHub default templates when nothing matches).
Changes:
- New
BranchType::pr_template_keys()helper and newhosting::templateresolver module. HostingPlatform::create_or_get_prgains atemplate: Option<&str>parameter;finish_workresolves and passes the template;main.rsdispatch simplified to forward&BranchTypeto release-fix/hotfix-fix finishers.- README and Claude skill docs document the new template lookup; tests/mocks updated for the new API and added unit tests for resolver and key mapping.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/git/branch.rs | Adds pr_template_keys() + tests mapping branch types to (specific, group) keys. |
| src/hosting/template.rs | New resolver module with specific→group→default lookup and tests. |
| src/hosting/mod.rs | Exports template module; extends trait signature with template param + doc. |
| src/hosting/github.rs | Uses provided template path first, falling back to repo default PR template paths. |
| src/flows/finish_work.rs | Resolves template, prints path, passes to hosting; release-fix/hotfix-fix take &BranchType. |
| src/main.rs | Drops manual destructuring; forwards branch_type to release-fix/hotfix-fix finishers. |
| tests/common/mod.rs | MockHosting updated for new signature; appends :template=... suffix in calls. |
| tests/finish_work_test.rs | Constructs BranchType values for the new finish API. |
| README.md | Documents .github/pr-templates/ resolution order and file mapping. |
| .claude/skills/bflow/SKILL.md | Mirrors README PR-template docs in the skill guide. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.