Files
codeql-action/src/repository.ts
T
2023-12-01 17:54:38 +00:00

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],
};
}