slice icon Context Slice

GitHub Pull Requests Guide

Pull requests propose changes from one branch to another. They combine code changes with discussion, review, and CI checks before merging.

PR States

PRs have state (open/closed) and merged status (true/false). A closed PR can be merged or unmerged. Filter by: state=open (active PRs), state=closed (completed), or check merged field for merge status.

Draft PRs (draft: true) indicate work in progress—not ready for review. Convert to ready via API when complete.

Creating PRs

Required: head (source branch with changes), base (target branch, usually main), title. Optional: body (description), draft (boolean). The branches must exist, and head must have commits not in base.

Common pattern: user creates feature branch, pushes commits, then asks to "create a PR." Confirm source and target branches before creating.

Review Workflow

PRs have reviews (APPROVED/CHANGES_REQUESTED/COMMENTED) and status checks (CI). The mergeable field indicates if the PR can merge without conflicts. Check mergeable_state for detailed status: clean, unstable (checks failing), blocked (review required), behind (needs rebase).

Comments and Reviews

Issue comments appear in the timeline. Review comments attach to specific code lines. PR reviews group comments with an overall verdict. When adding feedback, determine if it's general (issue comment) or code-specific (review comment).

Presentation

Show: number, title, state, author, base←head branches, reviews summary, checks status. Include link to GitHub for full diff view.