| 1 | import { z } from "zod"; |
| 2 | |
| 3 | export const pullRequestStates = |
| 4 | export const pullRequestFilters = |
| 5 | |
| 6 | type PullRequestSide |
| 7 | |
| 8 | /** `owner:branch` when the side lives in another repository than `other`. A deleted repository has no owner left to name. */ |
| 9 | export function branchLabel(side |
| 10 | if (side.username |
| 11 | return side.username |
| 12 | ? side.ref |
| 13 | : `${side.username |
| 14 | } |
| 15 | |
| 16 | export const mergeMethods = |
| 17 | export type MergeMethod |
| 18 | |
| 19 | export type PullRequestState |
| 20 | export type PullRequestFilter |
| 21 | |
| 22 | // git forbids these in a ref name, and `:` separates the owner in `owner:branch` |
| 23 | const REF = / |
| 24 | |
| 25 | export const createPullRequestSchema = |
| 26 | title: z |
| 27 | .string() |
| 28 | .min(1, " |
| 29 | .max(200, " |
| 30 | body: z |
| 31 | .string() |
| 32 | .max(20000, " |
| 33 | .optional(), |
| 34 | base: z |
| 35 | .string() |
| 36 | .min(1, " |
| 37 | .regex(REF, |
| 38 | head: z |
| 39 | .string() |
| 40 | .min(1, " |
| 41 | .regex( |
| 42 | /^[^\s~^:?*[\\ |
| 43 | "Use `branch` or `owner:branch`.", |
| 44 | ), |
| 45 | }); |
| 46 | |
| 47 | export type CreatePullRequestInput |