| 86 | } |
| 87 | |
| 88 | export function parseRemote(input: string): RemoteReference { |
| 89 | const reference = parse(input) |
| 90 | if (!reference) { |
| 91 | throw new InvalidReferenceError({ |
| 92 | repository: input, |
| 93 | message: "Repository must be a git URL, host/path reference, or GitHub owner/repo shorthand", |
| 94 | }) |
| 95 | } |
| 96 | if (!isRemote(reference)) { |
| 97 | throw new UnsupportedLocalRepositoryError({ |
| 98 | repository: input, |
| 99 | message: "Local file repositories are not supported", |
| 100 | }) |
| 101 | } |
| 102 | return reference |
| 103 | } |
| 104 | |
| 105 | export function validateBranch(branch: string): void { |
| 106 | if (/^[A-Za-z0-9/_.-]+$/.test(branch) && !branch.startsWith("-") && !branch.includes("..")) return |