Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Rename getMemoryFlagValue
  • Loading branch information
kaspersv committed Nov 27, 2025
commit 8d91fa189dd7a678f4f9b218f0e255362f1097d8
4 changes: 2 additions & 2 deletions lib/analyze-action.js

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

6 changes: 3 additions & 3 deletions lib/init-action.js

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

2 changes: 1 addition & 1 deletion src/config-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ const getOverlayDatabaseModeMacro = test.macro({
.stub(actionsUtil, "isAnalyzingPullRequest")
.returns(setup.isPullRequest);

sinon.stub(util, "getMemoryFlagValue").returns(setup.memoryFlagValue);
sinon.stub(util, "getCodeQLMemoryLimit").returns(setup.memoryFlagValue);

// Set up CodeQL mock
const codeql = mockCodeQLVersion(setup.codeqlVersion);
Expand Down
4 changes: 2 additions & 2 deletions src/config-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
cloneObject,
isDefined,
checkDiskUsage,
getMemoryFlagValue,
getCodeQLMemoryLimit,
} from "./util";

export * from "./config/db-config";
Expand Down Expand Up @@ -664,7 +664,7 @@ async function runnerSupportsOverlayAnalysis(
return false;
}

const memoryFlagValue = getMemoryFlagValue(ramInput, logger);
const memoryFlagValue = getCodeQLMemoryLimit(ramInput, logger);
if (memoryFlagValue < OVERLAY_MINIMUM_MEMORY_MB) {
logger.info(
`Setting overlay database mode to ${OverlayDatabaseMode.None} ` +
Expand Down
4 changes: 2 additions & 2 deletions src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ import {
codeQlVersionAtLeast,
DEFAULT_DEBUG_ARTIFACT_NAME,
DEFAULT_DEBUG_DATABASE_NAME,
getMemoryFlagValue,
getCodeQLMemoryLimit,
getRequiredEnvParam,
getThreadsFlagValue,
initializeEnvironment,
Expand Down Expand Up @@ -538,7 +538,7 @@ async function run() {
core.exportVariable(
"CODEQL_RAM",
process.env["CODEQL_RAM"] ||
getMemoryFlagValue(getOptionalInput("ram"), logger).toString(),
getCodeQLMemoryLimit(getOptionalInput("ram"), logger).toString(),
);
core.exportVariable(
"CODEQL_THREADS",
Expand Down
10 changes: 5 additions & 5 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,13 @@ function getCgroupMemoryLimitBytes(
}

/**
* Get the value of the codeql `--ram` flag as configured by the `ram` input.
* If no value was specified, the total available memory will be used minus a
* Get the maximum amount of memory CodeQL is allowed to use. If no limit has been
* configured by the user, then the total available memory will be used minus a
* threshold reserved for the OS.
*
* @returns {number} the amount of RAM to use, in megabytes
* @returns {number} the amount of RAM CodeQL is allowed to use, in megabytes
*/
export function getMemoryFlagValue(
export function getCodeQLMemoryLimit(
userInput: string | undefined,
logger: Logger,
): number {
Expand All @@ -337,7 +337,7 @@ export function getMemoryFlag(
userInput: string | undefined,
logger: Logger,
): string {
const megabytes = getMemoryFlagValue(userInput, logger);
const megabytes = getCodeQLMemoryLimit(userInput, logger);
return `--ram=${megabytes}`;
}

Expand Down