Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
c05a5b7
Add `ActionsEnvVars` enum
mbg Jun 16, 2026
652296e
Allow abstracting over `process.env`
mbg Jun 16, 2026
9c4ee01
Add `RemoteFileAddress` type
mbg Jun 23, 2026
07b6b1e
Move `getRemoteConfig` to `config/file.ts`
mbg Jun 23, 2026
9ef8be7
Refactor `parseRemoteFileAddress` out of `getRemoteConfig`
mbg Jun 23, 2026
82e5ca6
Return `RemoteFileAddress` from `parseRemoteFileAddress`
mbg Jun 23, 2026
c7a94c9
Add `getRemoteConfig` JSDoc
mbg Jun 23, 2026
85c8a8c
Add tests for `parseRemoteFileAddress`
mbg Jun 23, 2026
598d008
Make `ref` optional in `parseRemoteFileAddress`
mbg Jun 23, 2026
e537ff2
Make `path` optional in `parseRemoteFileAddress`
mbg Jun 23, 2026
12821cf
Make `owner` optional in `parseRemoteFileAddress`
mbg Jun 23, 2026
81ad479
Fix test names
mbg Jun 23, 2026
8102fa6
Anchor regex and trim input
mbg Jun 23, 2026
00e5a58
Update format in error message
mbg Jun 23, 2026
8d69da9
Improve whitespace handling
mbg Jun 23, 2026
3fe7ef9
Fix `getEnv` not using `getOptionalEnvVarFrom`
mbg Jun 23, 2026
812b882
Merge remote-tracking branch 'origin/main' into mbg/repo-props/config…
mbg Jun 23, 2026
f77cf55
Support old and new formats
mbg Jun 26, 2026
d8d1d6d
Add FF for shorthands
mbg Jun 24, 2026
e446d55
Add initial `ActionState` type
mbg Jun 30, 2026
f86aa52
Use `ActionState` for `getRemoteConfig`
mbg Jun 30, 2026
7b2af89
Add `TestEnv` class to simplify testing of `ActionState`-dependent fu…
mbg Jun 30, 2026
b6be81d
Gate new remote file format behind FF
mbg Jun 30, 2026
708e106
Index `ActionState` over the types of state used
mbg Jun 30, 2026
6cdc606
Create wrapper `runCliJson`
mario-campos Jul 1, 2026
7d1c6e9
Include `codeql` path in `runCliJson` error
mario-campos Jul 1, 2026
2399df7
Add `ActionsEnvVars` enum
mbg Jun 16, 2026
e190547
Allow abstracting over `process.env`
mbg Jun 16, 2026
9b35ab9
Add initial `ActionState` type
mbg Jun 30, 2026
26e9e9e
Add `TestEnv` class to simplify testing of `ActionState`-dependent fu…
mbg Jun 30, 2026
b009eac
Add `ActionsEnv` support to `ActionState`
mbg Jul 1, 2026
9c16c3b
Add common entry point
mbg Jul 1, 2026
a3a1cdd
Use the common entry point for `upload-sarif`
mbg Jul 1, 2026
6ab762c
Use the common entry point for `setup-codeql`
mbg Jul 1, 2026
6136b93
Use the common entry point for `init`
mbg Jul 1, 2026
a9ceac1
Accept `ActionState` in `getConfigFileInput`
mbg Jul 1, 2026
fcd9f6c
Fix `logger` reference
mbg Jul 1, 2026
772e8e9
Use the common entry point for `autobuild`
mbg Jul 1, 2026
ceac4af
Use the common entry point for `analyze`
mbg Jul 1, 2026
ef29bf2
Improve some comments
mbg Jul 1, 2026
1578ba0
Bump the actions-minor group across 1 directory with 3 updates
dependabot[bot] Jul 1, 2026
67ec1e3
Bump the npm-minor group across 1 directory with 6 updates
dependabot[bot] Jul 1, 2026
8f47ee7
Rebuild
github-actions[bot] Jul 1, 2026
fbcae9a
Rebuild
github-actions[bot] Jul 1, 2026
e0f825e
Bump js-yaml from 5.0.0 to 5.1.0
dependabot[bot] Jul 1, 2026
1ba7449
Rebuild
github-actions[bot] Jul 1, 2026
a8958a9
Keep the JSON exception message consistent
mario-campos Jul 1, 2026
d5b8046
Add JSDoc comment to `runCliJson`
mario-campos Jul 1, 2026
17a28bc
Merge pull request #3985 from github/dependabot/github_actions/dot-gi…
mbg Jul 1, 2026
289efca
Re-add `forceQuotes: true`
mbg Jul 1, 2026
50bd53b
Merge pull request #3989 from github/dependabot/npm_and_yarn/js-yaml-…
mbg Jul 1, 2026
c1e7c7a
Merge pull request #3981 from github/mario-campos/runCliJson
mario-campos Jul 1, 2026
a04a87c
Update changelog and version after v4.36.3
github-actions[bot] Jul 2, 2026
b987514
Rebuild
github-actions[bot] Jul 2, 2026
b16b719
Merge branch 'main' into dependabot/npm_and_yarn/npm-minor-41f3755806
mbg Jul 2, 2026
de65da3
Merge pull request #3991 from github/mergeback/v4.36.3-to-main-54f647b7
mbg Jul 2, 2026
3cf0a52
Merge pull request #3986 from github/dependabot/npm_and_yarn/npm-mino…
mbg Jul 2, 2026
5e3e6b8
Add `ActionsEnvVars` enum
mbg Jun 16, 2026
73b0850
Allow abstracting over `process.env`
mbg Jun 16, 2026
ae4c8d0
Merge pull request #3993 from github/mbg/env-abstraction
mbg Jul 6, 2026
eba9d55
Merge remote-tracking branch 'origin/main' into mbg/action-state
mbg Jul 6, 2026
5fa9c0c
Add and use `getDisplayActionName` for log message
mbg Jul 6, 2026
e34d7fe
Fix: Use `getTestActionsEnv`
mbg Jul 6, 2026
d309c0e
Improve `FieldsOf`
mbg Jul 6, 2026
006d029
Merge pull request #3990 from github/mbg/action-state
mbg Jul 6, 2026
5094019
Refactor `Config` type out of `config-utils`
mbg Jul 6, 2026
73f4741
Refactor pack registry code out of `config-utils`
mbg Jul 6, 2026
69c9e8c
Mark some `status-report` imports as `type`-only to avoid circular de…
mbg Jul 6, 2026
8e22350
Thread `ActionState` to `initConfig`
mbg Jul 6, 2026
7dc37cb
Merge remote-tracking branch 'origin/main' into mbg/repo-props/config…
mbg Jul 6, 2026
f58f0d1
Merge pull request #3973 from github/mbg/repo-props/config-file-short…
mbg Jul 7, 2026
43bec09
Update default bundle to codeql-bundle-v2.26.0
github-actions[bot] Jul 8, 2026
3f34ff0
Add changelog note
github-actions[bot] Jul 8, 2026
c7c896d
Merge pull request #3995 from github/update-bundle/codeql-bundle-v2.26.0
mbg Jul 8, 2026
72df218
Update changelog for v4.37.0
github-actions[bot] Jul 8, 2026
31c2707
Add changenote for #3973
mbg Jul 8, 2026
99df26d
Merge pull request #3996 from github/update-v4.37.0-c7c896d71
mbg Jul 8, 2026
b8c8426
Revert "Update version and changelog for v3.36.3"
github-actions[bot] Jul 8, 2026
157d34d
Revert "Rebuild"
github-actions[bot] Jul 8, 2026
0507814
Merge remote-tracking branch 'origin/releases/v4' into backport-v3.37…
github-actions[bot] Jul 8, 2026
530c909
Update version and changelog for v3.37.0
github-actions[bot] Jul 8, 2026
af1b30e
Rebuild
mbg Jul 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor pack registry code out of config-utils
  • Loading branch information
mbg committed Jul 6, 2026
commit 73f47410392899dac248fad4f67f344b29d9cda3
36 changes: 19 additions & 17 deletions lib/entry-points.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 5 additions & 46 deletions src/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ import {
UserConfig,
} from "./config/db-config";
import { getRemoteConfig } from "./config/file";
import {
parseRegistries,
type RegistryConfigNoCredentials,
type RegistryConfigWithCredentials,
} from "./config/pack-registries";
import {
addNoLanguageDiagnostic,
makeTelemetryDiagnostic,
Expand Down Expand Up @@ -123,29 +128,6 @@ const OVERLAY_MINIMUM_MEMORY_MB = 5 * 1024;
*/
const CODEQL_VERSION_REDUCED_OVERLAY_MEMORY_USAGE = "2.24.3";

export type RegistryConfigWithCredentials = RegistryConfigNoCredentials & {
// Token to use when downloading packs from this registry.
token: string;
};

/**
* The list of registries and the associated pack globs that determine where each
* pack can be downloaded from.
*/
export interface RegistryConfigNoCredentials {
// URL of a package registry, eg- https://ghcr.io/v2/
url: string;

// List of globs that determine which packs are associated with this registry.
packages: string[] | string;

// Kind of registry, either "github" or "docker". Default is "docker".
// "docker" refers specifically to the GitHub Container Registry, which is the usual way of sharing CodeQL packs.
// "github" refers to packs published as content in a GitHub repository. This kind of registry is used in scenarios
// where GHCR is not available, such as certain GHES environments.
kind?: "github" | "docker";
}

async function getSupportedLanguageMap(
codeql: CodeQL,
logger: Logger,
Expand Down Expand Up @@ -1200,29 +1182,6 @@ export async function initConfig(
return config;
}

function parseRegistries(
registriesInput: string | undefined,
): RegistryConfigWithCredentials[] | undefined {
try {
return registriesInput
? (yaml.load(registriesInput) as RegistryConfigWithCredentials[])
: undefined;
} catch {
throw new ConfigurationError(
"Invalid registries input. Must be a YAML string.",
);
}
}

export function parseRegistriesWithoutCredentials(
registriesInput?: string,
): RegistryConfigNoCredentials[] | undefined {
return parseRegistries(registriesInput)?.map((r) => {
const { url, packages, kind } = r;
return { url, packages, kind };
});
}

function isLocal(configPath: string): boolean {
// If the path starts with ./, look locally
if (configPath.indexOf("./") === 0) {
Expand Down
49 changes: 49 additions & 0 deletions src/config/pack-registries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import * as yaml from "js-yaml";

import { ConfigurationError } from "../util";

export type RegistryConfigWithCredentials = RegistryConfigNoCredentials & {
// Token to use when downloading packs from this registry.
token: string;
};

/**
* The list of registries and the associated pack globs that determine where each
* pack can be downloaded from.
*/
export interface RegistryConfigNoCredentials {
// URL of a package registry, eg- https://ghcr.io/v2/
url: string;

// List of globs that determine which packs are associated with this registry.
packages: string[] | string;

// Kind of registry, either "github" or "docker". Default is "docker".
// "docker" refers specifically to the GitHub Container Registry, which is the usual way of sharing CodeQL packs.
// "github" refers to packs published as content in a GitHub repository. This kind of registry is used in scenarios
// where GHCR is not available, such as certain GHES environments.
kind?: "github" | "docker";
}

export function parseRegistries(
registriesInput: string | undefined,
): RegistryConfigWithCredentials[] | undefined {
try {
return registriesInput
? (yaml.load(registriesInput) as RegistryConfigWithCredentials[])
: undefined;
} catch {
throw new ConfigurationError(
"Invalid registries input. Must be a YAML string.",
);
}
}

export function parseRegistriesWithoutCredentials(
registriesInput?: string,
): RegistryConfigNoCredentials[] | undefined {
return parseRegistries(registriesInput)?.map((r) => {
const { url, packages, kind } = r;
return { url, packages, kind };
});
}
3 changes: 2 additions & 1 deletion src/status-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
isSelfHostedRunner,
} from "./actions-util";
import { getAnalysisKey, getApiClient } from "./api-client";
import { parseRegistriesWithoutCredentials, type Config } from "./config-utils";
import type { Config } from "./config/action-config";
import { parseRegistriesWithoutCredentials } from "./config/pack-registries";
import { DependencyCacheRestoreStatusReport } from "./dependency-caching";
import { DocUrl } from "./doc-url";
import { EnvVar } from "./environment";
Expand Down