PullRequest
Source:
src/GitHub/PullRequest.ts
A GitHub pull request.
PullRequest manages the lifecycle of a pull request in a repository. PRs
are created on the first deploy and updated in place on subsequent deploys
when properties change. By default, pull requests are retained on
destruction to preserve history — set destroy() to opt in to closure.
Authentication is resolved via the GitHubCredentials service supplied by
GitHub.providers() (env, stored PAT, gh CLI, or OAuth). The token needs
repo scope for private repositories or public_repo for public ones.
Creating Pull Requests
Section titled “Creating Pull Requests”Create a Basic Pull Request
const pr = yield* GitHub.PullRequest("feature-pr", { owner: "my-org", repository: "my-repo", title: "Add new feature", body: "## Changes\n\nThis PR adds...", head: "feature-branch", base: "main",})Draft Pull Request with Reviewers
const pr = yield* GitHub.PullRequest("draft-pr", { owner: "my-org", repository: "my-repo", title: "WIP: New feature", body: "Work in progress...", head: "feature-branch", base: "main", draft: true, reviewers: ["reviewer1", "reviewer2"], teamReviewers: ["platform-team"],})Updating Pull Requests
Section titled “Updating Pull Requests”Deploy with the same logical ID and different properties to update the existing PR in place rather than creating a new one.
const pr = yield* GitHub.PullRequest("completed-pr", { owner: "my-org", repository: "my-repo", title: "Add new feature", body: "Completed and ready to merge.", head: "feature-branch", base: "main", state: "closed",})Pull Request with Labels and Milestone
Section titled “Pull Request with Labels and Milestone”const pr = yield* GitHub.PullRequest("release-pr", { owner: "my-org", repository: "my-repo", title: "Release v1.0", body: "Release notes...", head: "release-1.0", base: "main", labels: ["release", "v1.0"], milestone: 1,})Infrastructure Deployment PRs
Section titled “Infrastructure Deployment PRs”A common pattern is creating PRs for infrastructure changes that require review before merging.
yield* GitHub.PullRequest("infra-update", { owner: "my-org", repository: "my-repo", title: "Update infrastructure configuration", body: Output.interpolate` ## Infrastructure Changes
**Database:** ${database.endpoint} **Cache:** ${cache.endpoint}
Requires approval before deployment. `, head: "infra-updates", base: "main", labels: ["infrastructure"], reviewers: ["infrastructure-lead"],})