| name | description | license | tags |
|---|---|---|---|
| create-pull-request | Automatically create well-structured GitHub pull requests from a branch. Generates descriptive titles, summaries, test plans, and reviewer suggestions based on the diff and commit history. | MIT | --- git github automation workflow collaboration |
Create Pull Request
Overview
Automate GitHub pull request creation with comprehensive descriptions, test plans, and reviewer assignments based on code diff analysis and commit history.
When to Use
- When you want to create a PR from a feature branch to main/develop
- When you need a well-structured PR description generated from your changes
- When you want to auto-assign reviewers based on code ownership
- When you need consistent PR formatting across a team
- When preparing a PR after completing a feature or bug fix
Instructions
- Verify GitHub CLI authentication with
gh auth status. - Identify source branch and target branch (default: main).
- Analyze the diff:
git diff <target>..<source> --statto understand scope of changes. - Review commit messages:
git log <target>..<source> --onelinefor context. - Generate PR title: concise, imperative mood, under 72 characters.
- Generate PR body with sections: Summary, Changes, Testing, Screenshots (if UI), Breaking Changes.
- Identify reviewers from CODEOWNERS or recent contributors to changed files.
- Create PR:
gh pr create --title "..." --body "..." --reviewer "..." --base <target>. - Apply relevant labels based on change type (feature, bugfix, docs, chore).
- Return PR URL and summary.
Environment
DEFAULT_BASE_BRANCH=main
AUTO_ASSIGN_REVIEWERS=true
REQUIRE_TEST_PLAN=true
LABEL_BY_TYPE=true
DRAFT_BY_DEFAULT=false
Examples
Input:
source_branch: feature/user-auth
target_branch: main
reviewer: @teamlead
Output:
PR Created: #142
Title: Add JWT-based user authentication system
URL: https://github.com/org/repo/pull/142
Reviewers: @teamlead, @security-team
Labels: feature, auth
Files changed: 8 (+342 -12 lines)