The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type * as Pulls from "@distilled.cloud/github/pulls"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import type { RuntimeContext } from "alchemy/RuntimeContext"; |
| 4 | import type * as Effect from "effect/Effect"; |
| 5 | import type { Repository } from "./Repository.ts"; |
| 6 | |
| 7 | export interface CreatePullRequestRequest extends Omit<Pulls.CreateRequest, "owner" | "repo"> {} |
| 8 | |
| 9 | export type CreatePullRequestResponse = Pulls.PullRequest; |
| 10 | |
| 11 | /** |
| 12 | * Open a pull request (`pulls.create`). The `head` branch must already exist; |
| 13 | * pushing commits to it is up to the caller. |
| 14 | * |
| 15 | * Provide `GitHub.CreatePullRequestHttp` on a Worker or Function, or |
| 16 | * `GitHub.CreatePullRequestLocal` on an Action. |
| 17 | * |
| 18 | * ### Opening Pull Requests at Runtime |
| 19 | * **Example:** Open a pull request from a branch |
| 20 | * ```typescript |
| 21 | * const createPullRequest = yield* GitHub.CreatePullRequest(yield* Repo); |
| 22 | * const pull = yield* createPullRequest({ |
| 23 | * title: "fix: typo in README", |
| 24 | * head: "fix/readme-typo", |
| 25 | * base: "main", |
| 26 | * body: "Closes #7.", |
| 27 | * }); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | * @product Pull Request |
| 32 | */ |
| 33 | export interface CreatePullRequest extends Binding.Service< |
| 34 | CreatePullRequest, |
| 35 | "GitHub.CreatePullRequest", |
| 36 | ( |
| 37 | repo: Repository, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request: CreatePullRequestRequest, |
| 41 | ) => Effect.Effect<CreatePullRequestResponse, Pulls.CreateError, RuntimeContext> |
| 42 | > |
| 43 | > {} |
| 44 | |
| 45 | export const CreatePullRequest = Binding.Service<CreatePullRequest>("GitHub.CreatePullRequest"); |