GitHub.Pull Request reference
CreatePullRequest
Section titled “CreatePullRequest”Source:
packages/github/src/CreatePullRequest.ts
Open a pull request (pulls.create). The head branch must already exist;
pushing commits to it is up to the caller.
Provide GitHub.CreatePullRequestHttp on a Worker or Function, or
GitHub.CreatePullRequestLocal on an Action.
CreatePullRequest: Opening Pull Requests at Runtime
Section titled “CreatePullRequest: Opening Pull Requests at Runtime”const createPullRequest = yield* GitHub.CreatePullRequest(yield* Repo);const pull = yield* createPullRequest({ title: "fix: typo in README", head: "fix/readme-typo", base: "main", body: "Closes #7.",});CreatePullRequestHttp
Section titled “CreatePullRequestHttp”Source:
packages/github/src/CreatePullRequestHttp.tsKind: Layer · Provides:GitHub.CreatePullRequest
Token-backed implementation of CreatePullRequest. Provide it on a Worker or
Function: it captures a GitHub.PersonalAccessToken for the host and binds
the token and the repository into it.
CreatePullRequestLocal
Section titled “CreatePullRequestLocal”Source:
packages/github/src/CreatePullRequestLocal.tsKind: Layer · Provides:GitHub.CreatePullRequest
Implementation of CreatePullRequest with the provider’s current credentials.
Provide it on an Action or another deploy-time Effect.
CreatePullRequestReview
Section titled “CreatePullRequestReview”Source:
packages/github/src/CreatePullRequestReview.ts
Submit a pull request review (pulls.createReview): a body, an event
verdict (APPROVE, REQUEST_CHANGES or COMMENT) and inline comments on
diff lines, in one submission.
Provide GitHub.CreatePullRequestReviewHttp on a Worker or Function, or
GitHub.CreatePullRequestReviewLocal on an Action.
CreatePullRequestReview: Reviewing Pull Requests at Runtime
Section titled “CreatePullRequestReview: Reviewing Pull Requests at Runtime”const createReview = yield* GitHub.CreatePullRequestReview(yield* Repo);yield* createReview({ pull_number: 9, event: "REQUEST_CHANGES", body: "One problem, inline.", comments: [{ path: "src/index.ts", line: 42, body: "Off by one." }],});CreatePullRequestReviewHttp
Section titled “CreatePullRequestReviewHttp”Source:
packages/github/src/CreatePullRequestReviewHttp.tsKind: Layer · Provides:GitHub.CreatePullRequestReview
Token-backed implementation of CreatePullRequestReview. Provide it on a Worker or
Function: it captures a GitHub.PersonalAccessToken for the host and binds
the token and the repository into it.
CreatePullRequestReviewLocal
Section titled “CreatePullRequestReviewLocal”Source:
packages/github/src/CreatePullRequestReviewLocal.tsKind: Layer · Provides:GitHub.CreatePullRequestReview
Implementation of CreatePullRequestReview with the provider’s current credentials.
Provide it on an Action or another deploy-time Effect.
GetPullRequest
Section titled “GetPullRequest”Source:
packages/github/src/GetPullRequest.ts
Get a pull request by number (pulls.get). Like the API, accept selects
the media type: application/vnd.github.diff or
application/vnd.github.patch return the diff or patch text instead of the
JSON object.
Provide GitHub.GetPullRequestHttp on a Worker or Function, or
GitHub.GetPullRequestLocal on an Action.
GetPullRequest: Reading Pull Requests at Runtime
Section titled “GetPullRequest: Reading Pull Requests at Runtime”const getPullRequest = yield* GitHub.GetPullRequest(yield* Repo);const pull = yield* getPullRequest({ pull_number: 9 });const diff = yield* getPullRequest({ pull_number: 9, accept: "application/vnd.github.diff",});GetPullRequestHttp
Section titled “GetPullRequestHttp”Source:
packages/github/src/GetPullRequestHttp.tsKind: Layer · Provides:GitHub.GetPullRequest
Token-backed implementation of GetPullRequest. Provide it on a Worker or
Function: it captures a GitHub.PersonalAccessToken for the host and binds
the token and the repository into it.
GetPullRequestLocal
Section titled “GetPullRequestLocal”Source:
packages/github/src/GetPullRequestLocal.tsKind: Layer · Provides:GitHub.GetPullRequest
Implementation of GetPullRequest with the provider’s current credentials.
Provide it on an Action or another deploy-time Effect.
ListPullRequestFiles
Section titled “ListPullRequestFiles”Source:
packages/github/src/ListPullRequestFiles.ts
List one page of the files a pull request changes (pulls.listFiles), each
with its status, line counts and patch. Unlike GetPullRequest with
format: "diff", it pages through changes of any size (up to 3000 files).
Provide GitHub.ListPullRequestFilesHttp on a Worker or Function, or
GitHub.ListPullRequestFilesLocal on an Action.
ListPullRequestFiles: Listing Changed Files at Runtime
Section titled “ListPullRequestFiles: Listing Changed Files at Runtime”const listFiles = yield* GitHub.ListPullRequestFiles(yield* Repo);const files = yield* listFiles({ pull_number: 9, per_page: 100 });const paths = files.map((file) => file.filename);ListPullRequestFilesHttp
Section titled “ListPullRequestFilesHttp”Source:
packages/github/src/ListPullRequestFilesHttp.tsKind: Layer · Provides:GitHub.ListPullRequestFiles
Token-backed implementation of ListPullRequestFiles. Provide it on a Worker or
Function: it captures a GitHub.PersonalAccessToken for the host and binds
the token and the repository into it.
ListPullRequestFilesLocal
Section titled “ListPullRequestFilesLocal”Source:
packages/github/src/ListPullRequestFilesLocal.tsKind: Layer · Provides:GitHub.ListPullRequestFiles
Implementation of ListPullRequestFiles with the provider’s current credentials.
Provide it on an Action or another deploy-time Effect.
ListPullRequestReviewComments
Section titled “ListPullRequestReviewComments”Source:
packages/github/src/ListPullRequestReviewComments.ts
List one page of a pull request’s inline review comments
(pulls.listReviewComments), each anchored to a path and line of the
diff.
Provide GitHub.ListPullRequestReviewCommentsHttp on a Worker or Function, or
GitHub.ListPullRequestReviewCommentsLocal on an Action.
ListPullRequestReviewComments: Listing Review Comments at Runtime
Section titled “ListPullRequestReviewComments: Listing Review Comments at Runtime”const listReviewComments = yield* GitHub.ListPullRequestReviewComments(yield* Repo);const comments = yield* listReviewComments({ pull_number: 9, per_page: 100 });ListPullRequestReviewCommentsHttp
Section titled “ListPullRequestReviewCommentsHttp”Source:
packages/github/src/ListPullRequestReviewCommentsHttp.tsKind: Layer · Provides:GitHub.ListPullRequestReviewComments
Token-backed implementation of ListPullRequestReviewComments. Provide it on a Worker or
Function: it captures a GitHub.PersonalAccessToken for the host and binds
the token and the repository into it.
ListPullRequestReviewCommentsLocal
Section titled “ListPullRequestReviewCommentsLocal”Source:
packages/github/src/ListPullRequestReviewCommentsLocal.tsKind: Layer · Provides:GitHub.ListPullRequestReviewComments
Implementation of ListPullRequestReviewComments with the provider’s current credentials.
Provide it on an Action or another deploy-time Effect.
ListPullRequestReviews
Section titled “ListPullRequestReviews”Source:
packages/github/src/ListPullRequestReviews.ts
List one page of a pull request’s reviews (pulls.listReviews).
Provide GitHub.ListPullRequestReviewsHttp on a Worker or Function, or
GitHub.ListPullRequestReviewsLocal on an Action.
ListPullRequestReviews: Listing Reviews at Runtime
Section titled “ListPullRequestReviews: Listing Reviews at Runtime”const listReviews = yield* GitHub.ListPullRequestReviews(yield* Repo);const reviews = yield* listReviews({ pull_number: 9 });const approved = reviews.some((review) => review.state === "APPROVED");ListPullRequestReviewsHttp
Section titled “ListPullRequestReviewsHttp”Source:
packages/github/src/ListPullRequestReviewsHttp.tsKind: Layer · Provides:GitHub.ListPullRequestReviews
Token-backed implementation of ListPullRequestReviews. Provide it on a Worker or
Function: it captures a GitHub.PersonalAccessToken for the host and binds
the token and the repository into it.
ListPullRequestReviewsLocal
Section titled “ListPullRequestReviewsLocal”Source:
packages/github/src/ListPullRequestReviewsLocal.tsKind: Layer · Provides:GitHub.ListPullRequestReviews
Implementation of ListPullRequestReviews with the provider’s current credentials.
Provide it on an Action or another deploy-time Effect.
ListPullRequests
Section titled “ListPullRequests”Source:
packages/github/src/ListPullRequests.ts
List one page of the repository’s pull requests (pulls.list).
Provide GitHub.ListPullRequestsHttp on a Worker or Function, or
GitHub.ListPullRequestsLocal on an Action.
ListPullRequests: Listing Pull Requests at Runtime
Section titled “ListPullRequests: Listing Pull Requests at Runtime”const listPullRequests = yield* GitHub.ListPullRequests(yield* Repo);const open = yield* listPullRequests({ state: "open", base: "main" });ListPullRequestsHttp
Section titled “ListPullRequestsHttp”Source:
packages/github/src/ListPullRequestsHttp.tsKind: Layer · Provides:GitHub.ListPullRequests
Token-backed implementation of ListPullRequests. Provide it on a Worker or
Function: it captures a GitHub.PersonalAccessToken for the host and binds
the token and the repository into it.
ListPullRequestsLocal
Section titled “ListPullRequestsLocal”Source:
packages/github/src/ListPullRequestsLocal.tsKind: Layer · Provides:GitHub.ListPullRequests
Implementation of ListPullRequests with the provider’s current credentials.
Provide it on an Action or another deploy-time Effect.
MergePullRequest
Section titled “MergePullRequest”Source:
packages/github/src/MergePullRequest.ts
Merge a pull request (pulls.merge). Gate it yourself, e.g. on an approval
from ListPullRequestReviews.
Provide GitHub.MergePullRequestHttp on a Worker or Function, or
GitHub.MergePullRequestLocal on an Action.
MergePullRequest: Merging Pull Requests at Runtime
Section titled “MergePullRequest: Merging Pull Requests at Runtime”const listReviews = yield* GitHub.ListPullRequestReviews(yield* Repo);const mergePullRequest = yield* GitHub.MergePullRequest(yield* Repo);
const reviews = yield* listReviews({ pull_number: 9 });if (reviews.some((review) => review.state === "APPROVED")) { yield* mergePullRequest({ pull_number: 9, merge_method: "squash" });}MergePullRequestHttp
Section titled “MergePullRequestHttp”Source:
packages/github/src/MergePullRequestHttp.tsKind: Layer · Provides:GitHub.MergePullRequest
Token-backed implementation of MergePullRequest. Provide it on a Worker or
Function: it captures a GitHub.PersonalAccessToken for the host and binds
the token and the repository into it.
MergePullRequestLocal
Section titled “MergePullRequestLocal”Source:
packages/github/src/MergePullRequestLocal.tsKind: Layer · Provides:GitHub.MergePullRequest
Implementation of MergePullRequest with the provider’s current credentials.
Provide it on an Action or another deploy-time Effect.
PullRequest
Section titled “PullRequest”Source:
packages/github/src/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 GitHub Credentials 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.
PullRequest: Creating Pull Requests
Section titled “PullRequest: 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"],})PullRequest: Updating Pull Requests
Section titled “PullRequest: 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",})PullRequest: Pull Request with Labels and Milestone
Section titled “PullRequest: 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,})PullRequest: Infrastructure Deployment PRs
Section titled “PullRequest: 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"],})