Merge pull request #3249 from github/henrymercer/api-logging

Use Actions logger in API client
This commit is contained in:
Henry Mercer
2025-10-28 17:05:58 +00:00
committed by GitHub
16 changed files with 7575 additions and 8007 deletions
+763 -800
View File
File diff suppressed because it is too large Load Diff
+554 -591
View File
File diff suppressed because it is too large Load Diff
+525 -562
View File
File diff suppressed because it is too large Load Diff
+780 -817
View File
File diff suppressed because it is too large Load Diff
+550 -587
View File
File diff suppressed because it is too large Load Diff
+529 -566
View File
File diff suppressed because it is too large Load Diff
+531 -568
View File
File diff suppressed because it is too large Load Diff
+749 -786
View File
File diff suppressed because it is too large Load Diff
+773 -810
View File
File diff suppressed because it is too large Load Diff
+513 -558
View File
File diff suppressed because it is too large Load Diff
+749 -786
View File
File diff suppressed because it is too large Load Diff
+533 -570
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -4508,6 +4508,8 @@
},
"node_modules/console-log-level": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/console-log-level/-/console-log-level-1.4.1.tgz",
"integrity": "sha512-VZzbIORbP+PPcN/gg3DXClTLPLg5Slwd5fL2MIc+o1qZ4BXBvWyc6QxPk6T/Mkr6IVjRpoAGf32XxP3ZWMVRcQ==",
"license": "MIT"
},
"node_modules/convert-to-spaces": {
+9 -3
View File
@@ -9,9 +9,15 @@ if [ "$GITHUB_ACTIONS" = "true" ]; then
fi
# Check if npm install is likely needed before proceeding
if [ ! -d node_modules ] || [ package-lock.json -nt node_modules/.package-lock.json ]; then
echo "Running 'npm install' because 'node_modules/.package-lock.json' appears to be outdated..."
if [ ! -d node_modules ]; then
echo "Running 'npm install' because 'node_modules' directory is missing."
npm install
elif [ package.json -nt package-lock.json ]; then
echo "Running 'npm install' because 'package-lock.json' appears to be outdated."
npm install
elif [ package-lock.json -nt node_modules/.package-lock.json ]; then
echo "Running 'npm install' because 'node_modules/.package-lock.json' appears to be outdated."
npm install
else
echo "Skipping 'npm install' because 'node_modules/.package-lock.json' appears to be up-to-date."
echo "Skipping 'npm install' because everything appears to be up-to-date."
fi
+6 -2
View File
@@ -1,7 +1,6 @@
import * as core from "@actions/core";
import * as githubUtils from "@actions/github/lib/utils";
import * as retry from "@octokit/plugin-retry";
import consoleLogLevel from "console-log-level";
import { getActionVersion, getRequiredInput } from "./actions-util";
import { Logger } from "./logging";
@@ -50,7 +49,12 @@ function createApiClientWithDetails(
githubUtils.getOctokitOptions(auth, {
baseUrl: apiDetails.apiURL,
userAgent: `CodeQL-Action/${getActionVersion()}`,
log: consoleLogLevel({ level: "debug" }),
log: {
debug: core.debug,
info: core.info,
warn: core.warning,
error: core.error,
},
}),
);
}
+9 -1
View File
@@ -13,7 +13,15 @@ export interface Logger {
}
export function getActionsLogger(): Logger {
return core;
return {
debug: core.debug,
info: core.info,
warning: core.warning,
error: core.error,
isDebug: core.isDebug,
startGroup: core.startGroup,
endGroup: core.endGroup,
};
}
export function getRunnerLogger(debugMode: boolean): Logger {