Skip to content

Commit 02283e9

Browse files
committed
Move more GitHub-related definitions from util.ts to github.ts
1 parent 86bc444 commit 02283e9

3 files changed

Lines changed: 69 additions & 67 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 52 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/github.ts‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
import { ActionsEnvVars, type ReadOnlyEnv } from "./environment";
2-
import { ConfigurationError } from "./util";
2+
import { ConfigurationError } from "./errors";
3+
4+
export enum GitHubVariant {
5+
/** [GitHub.com](https://github.com) */
6+
DOTCOM = "GitHub.com",
7+
/** [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@latest/admin/overview/about-github-enterprise-server) */
8+
GHES = "GitHub Enterprise Server",
9+
/** [GitHub Enterprise Cloud with data residency](https://docs.github.com/en/enterprise-cloud@latest/admin/data-residency/about-github-enterprise-cloud-with-data-residency) */
10+
GHEC_DR = "GitHub Enterprise Cloud with data residency",
11+
}
12+
13+
export type GitHubVersion =
14+
| { type: GitHubVariant.DOTCOM }
15+
| { type: GitHubVariant.GHEC_DR }
16+
| { type: GitHubVariant.GHES; version: string };
317

418
/** A string representing a GitHub instance address. */
519
export type InstanceURL = string;

‎src/util.ts‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
type Env,
2525
} from "./environment";
2626
import { ConfigurationError, getErrorMessage, wrapError } from "./errors";
27+
import { GitHubVariant, type GitHubVersion } from "./github";
2728
import type { Language } from "./languages";
2829
import type { Logger } from "./logging";
2930

@@ -35,6 +36,7 @@ export {
3536
getEnv,
3637
isInTestMode,
3738
} from "./environment";
39+
export { GitHubVariant, type GitHubVersion } from "./github";
3840

3941
/**
4042
* The name of the file containing the base database OIDs, as stored in the
@@ -471,20 +473,6 @@ const CODEQL_ACTION_WARNED_ABOUT_VERSION_ENV_VAR =
471473

472474
let hasBeenWarnedAboutVersion = false;
473475

474-
export enum GitHubVariant {
475-
/** [GitHub.com](https://github.com) */
476-
DOTCOM = "GitHub.com",
477-
/** [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server@latest/admin/overview/about-github-enterprise-server) */
478-
GHES = "GitHub Enterprise Server",
479-
/** [GitHub Enterprise Cloud with data residency](https://docs.github.com/en/enterprise-cloud@latest/admin/data-residency/about-github-enterprise-cloud-with-data-residency) */
480-
GHEC_DR = "GitHub Enterprise Cloud with data residency",
481-
}
482-
483-
export type GitHubVersion =
484-
| { type: GitHubVariant.DOTCOM }
485-
| { type: GitHubVariant.GHEC_DR }
486-
| { type: GitHubVariant.GHES; version: string };
487-
488476
export function checkGitHubVersionInRange(
489477
version: GitHubVersion,
490478
logger: Logger,

0 commit comments

Comments
 (0)