mirror of
https://github.com/github/codeql-action.git
synced 2026-05-07 14:20:19 +00:00
19 lines
427 B
TypeScript
19 lines
427 B
TypeScript
import { UserError } from "./util";
|
|
|
|
// A repository name with owner, parsed into its two parts
|
|
export interface RepositoryNwo {
|
|
owner: string;
|
|
repo: string;
|
|
}
|
|
|
|
export function parseRepositoryNwo(input: string): RepositoryNwo {
|
|
const parts = input.split("/");
|
|
if (parts.length !== 2) {
|
|
throw new UserError(`"${input}" is not a valid repository name`);
|
|
}
|
|
return {
|
|
owner: parts[0],
|
|
repo: parts[1],
|
|
};
|
|
}
|