Add and use RepositoryNwoStr type

This commit is contained in:
Michael B. Gale
2026-10-12 15:27:32 +01:00
parent c1b620cc0e
commit ad8ebce293
3 changed files with 35 additions and 5 deletions

View File

@@ -6,6 +6,14 @@ export interface RepositoryNwo {
repo: string;
}
/** An approximation of what a repository NWO string looks like. */
export type RepositoryNwoStr = `${string}/${string}`;
/** A basic check that `val` looks like a `RepositoryNwoStr`. */
export function isRepositoryNwoStr(val: string): val is RepositoryNwoStr {
return val.includes("/");
}
/**
* Get the repository name with owner from the environment variable
* `GITHUB_REPOSITORY`.