1 line
4.3 KiB
JSON
1 line
4.3 KiB
JSON
{"content": "# How to Create a Pull Request Using GitHub CLI\n\nThis guide explains how to create pull requests using GitHub CLI in our project.\n\n## Prerequisites\n\n1. Install GitHub CLI if you haven't already:\n\n ```bash\n # macOS\n brew install gh\n\n # Windows\n winget install --id GitHub.cli\n\n # Linux\n # Follow instructions at https://github.com/cli/cli/blob/trunk/docs/install_linux.md\n ```\n\n2. Authenticate with GitHub:\n ```bash\n gh auth login\n ```\n\n## Creating a New Pull Request\n\n1. First, prepare your PR description following the template in `.github/pull_request_template.md`\n\n2. Use the `gh pr create` command to create a new pull request:\n\n ```bash\n # Basic command structure\n gh pr create --title \"✨(scope): Your descriptive title\" --body \"Your PR description\" --base main --draft\n ```\n\n For more complex PR descriptions with proper formatting, use the `--body-file` option with the exact PR template structure:\n\n ```bash\n # Create PR with proper template structure\n gh pr create --title \"✨(scope): Your descriptive title\" --body-file <(echo -e \"## Issue\\n\\n- resolve:\\n\\n## Why is this change needed?\\nYour description here.\\n\\n## What would you like reviewers to focus on?\\n- Point 1\\n- Point 2\\n\\n## Testing Verification\\nHow you tested these changes.\\n\\n## What was done\\npr_agent:summary\\n\\n## Detailed Changes\\npr_agent:walkthrough\\n\\n## Additional Notes\\nAny additional notes.\") --base main --draft\n ```\n\n## Best Practices\n\n1. **PR Title Format**: Use conventional commit format with emojis\n\n - Always include an appropriate emoji at the beginning of the title\n - Use the actual emoji character (not the code representation like `:sparkles:`)\n - Examples:\n - `✨(supabase): Add staging remote configuration`\n - `🐛(auth): Fix login redirect issue`\n - `📝(readme): Update installation instructions`\n\n2. **Description Template**: Always use our PR template structure from `.github/pull_request_template.md`:\n\n - Issue reference\n - Why the change is needed\n - Review focus points\n - Testing verification\n - PR-Agent sections (keep `pr_agent:summary` and `pr_agent:walkthrough` tags intact)\n - Additional notes\n\n3. **Template Accuracy**: Ensure your PR description precisely follows the template structure:\n\n - Don't modify or rename the PR-Agent sections (`pr_agent:summary` and `pr_agent:walkthrough`)\n - Keep all section headers exactly as they appear in the template\n - Don't add custom sections that aren't in the template\n\n4. **Draft PRs**: Start as draft when the work is in progress\n - Use `--draft` flag in the command\n - Convert to ready for review when complete using `gh pr ready`\n\n### Common Mistakes to Avoid\n\n1. **Incorrect Section Headers**: Always use the exact section headers from the template\n2. **Modifying PR-Agent Sections**: Don't remove or modify the `pr_agent:summary` and `pr_agent:walkthrough` placeholders\n3. **Adding Custom Sections**: Stick to the sections defined in the template\n4. **Using Outdated Templates**: Always refer to the current `.github/pull_request_template.md` file\n\n### Missing Sections\n\nAlways include all template sections, even if some are marked as \"N/A\" or \"None\"\n\n## Additional GitHub CLI PR Commands\n\nHere are some additional useful GitHub CLI commands for managing PRs:\n\n```bash\n# List your open pull requests\ngh pr list --author \"@me\"\n\n# Check PR status\ngh pr status\n\n# View a specific PR\ngh pr view <PR-NUMBER>\n\n# Check out a PR branch locally\ngh pr checkout <PR-NUMBER>\n\n# Convert a draft PR to ready for review\ngh pr ready <PR-NUMBER>\n\n# Add reviewers to a PR\ngh pr edit <PR-NUMBER> --add-reviewer username1,username2\n\n# Merge a PR\ngh pr merge <PR-NUMBER> --squash\n```\n\n## Using Templates for PR Creation\n\nTo simplify PR creation with consistent descriptions, you can create a template file:\n\n1. Create a file named `pr-template.md` with your PR template\n2. Use it when creating PRs:\n\n```bash\ngh pr create --title \"feat(scope): Your title\" --body-file pr-template.md --base main --draft\n```\n\n## Related Documentation\n\n- [PR Template](.github/pull_request_template.md)\n- [Conventional Commits](https://www.conventionalcommits.org/)\n- [GitHub CLI documentation](https://cli.github.com/manual/)\n"} |