mirror of
https://github.com/github/codeql-action.git
synced 2026-01-06 06:30:10 +08:00
Address feedback: cache git version, improve error handling, add telemetry
- Cache the git version to avoid recomputing on repeated calls - Refactor getGitVersion to getGitVersionOrThrow with detailed errors - Add getGitVersion that logs errors and handles caching - Add makeTelemetryDiagnostic helper to diagnostics.ts - Add logGitVersionTelemetry function to log git version telemetry - Call logGitVersionTelemetry in init-action.ts - Add resetCachedGitVersion for testing - Update tests to work with new function signatures and caching Co-authored-by: henrymercer <14129055+henrymercer@users.noreply.github.com>
This commit is contained in:
321
lib/init-action.js
generated
321
lib/init-action.js
generated
@@ -85283,7 +85283,7 @@ function getDependencyCachingEnabled() {
|
||||
|
||||
// src/config-utils.ts
|
||||
var fs6 = __toESM(require("fs"));
|
||||
var path7 = __toESM(require("path"));
|
||||
var path8 = __toESM(require("path"));
|
||||
var import_perf_hooks = require("perf_hooks");
|
||||
|
||||
// src/config/db-config.ts
|
||||
@@ -85631,7 +85631,7 @@ function parseUserConfig(logger, pathInput, contents, validateConfig) {
|
||||
|
||||
// src/feature-flags.ts
|
||||
var fs4 = __toESM(require("fs"));
|
||||
var path5 = __toESM(require("path"));
|
||||
var path6 = __toESM(require("path"));
|
||||
var semver5 = __toESM(require_semver2());
|
||||
|
||||
// src/defaults.json
|
||||
@@ -85640,35 +85640,171 @@ var cliVersion = "2.23.8";
|
||||
|
||||
// src/overlay-database-utils.ts
|
||||
var fs3 = __toESM(require("fs"));
|
||||
var path4 = __toESM(require("path"));
|
||||
var path5 = __toESM(require("path"));
|
||||
var actionsCache = __toESM(require_cache3());
|
||||
|
||||
// src/git-utils.ts
|
||||
var core7 = __toESM(require_core());
|
||||
var core8 = __toESM(require_core());
|
||||
var toolrunner2 = __toESM(require_toolrunner());
|
||||
var io3 = __toESM(require_io2());
|
||||
var semver3 = __toESM(require_semver2());
|
||||
var GIT_MINIMUM_VERSION_FOR_OVERLAY = "2.38.0";
|
||||
async function getGitVersion() {
|
||||
|
||||
// src/diagnostics.ts
|
||||
var import_fs = require("fs");
|
||||
var import_path = __toESM(require("path"));
|
||||
|
||||
// src/logging.ts
|
||||
var core7 = __toESM(require_core());
|
||||
function getActionsLogger() {
|
||||
return {
|
||||
debug: core7.debug,
|
||||
info: core7.info,
|
||||
warning: core7.warning,
|
||||
error: core7.error,
|
||||
isDebug: core7.isDebug,
|
||||
startGroup: core7.startGroup,
|
||||
endGroup: core7.endGroup
|
||||
};
|
||||
}
|
||||
async function withGroupAsync(groupName, f) {
|
||||
core7.startGroup(groupName);
|
||||
try {
|
||||
const stdout = await runGitCommand(
|
||||
void 0,
|
||||
["--version"],
|
||||
"Failed to get git version."
|
||||
return await f();
|
||||
} finally {
|
||||
core7.endGroup();
|
||||
}
|
||||
}
|
||||
function formatDuration(durationMs) {
|
||||
if (durationMs < 1e3) {
|
||||
return `${durationMs}ms`;
|
||||
}
|
||||
if (durationMs < 60 * 1e3) {
|
||||
return `${(durationMs / 1e3).toFixed(1)}s`;
|
||||
}
|
||||
const minutes = Math.floor(durationMs / (60 * 1e3));
|
||||
const seconds = Math.floor(durationMs % (60 * 1e3) / 1e3);
|
||||
return `${minutes}m${seconds}s`;
|
||||
}
|
||||
|
||||
// src/diagnostics.ts
|
||||
var unwrittenDiagnostics = [];
|
||||
function makeDiagnostic(id, name, data = void 0) {
|
||||
return {
|
||||
...data,
|
||||
timestamp: data?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
||||
source: { ...data?.source, id, name }
|
||||
};
|
||||
}
|
||||
function addDiagnostic(config, language, diagnostic) {
|
||||
const logger = getActionsLogger();
|
||||
const databasePath = language ? getCodeQLDatabasePath(config, language) : config.dbLocation;
|
||||
if ((0, import_fs.existsSync)(databasePath)) {
|
||||
writeDiagnostic(config, language, diagnostic);
|
||||
} else {
|
||||
logger.debug(
|
||||
`Writing a diagnostic for ${language}, but the database at ${databasePath} does not exist yet.`
|
||||
);
|
||||
const match = stdout.match(/git version (\d+\.\d+\.\d+)/);
|
||||
if (match?.[1]) {
|
||||
return match[1];
|
||||
unwrittenDiagnostics.push({ diagnostic, language });
|
||||
}
|
||||
}
|
||||
function writeDiagnostic(config, language, diagnostic) {
|
||||
const logger = getActionsLogger();
|
||||
const databasePath = language ? getCodeQLDatabasePath(config, language) : config.dbLocation;
|
||||
const diagnosticsPath = import_path.default.resolve(
|
||||
databasePath,
|
||||
"diagnostic",
|
||||
"codeql-action"
|
||||
);
|
||||
try {
|
||||
(0, import_fs.mkdirSync)(diagnosticsPath, { recursive: true });
|
||||
const jsonPath = import_path.default.resolve(
|
||||
diagnosticsPath,
|
||||
// Remove colons from the timestamp as these are not allowed in Windows filenames.
|
||||
`codeql-action-${diagnostic.timestamp.replaceAll(":", "")}.json`
|
||||
);
|
||||
(0, import_fs.writeFileSync)(jsonPath, JSON.stringify(diagnostic));
|
||||
} catch (err) {
|
||||
logger.warning(`Unable to write diagnostic message to database: ${err}`);
|
||||
logger.debug(JSON.stringify(diagnostic));
|
||||
}
|
||||
}
|
||||
function logUnwrittenDiagnostics() {
|
||||
const logger = getActionsLogger();
|
||||
const num = unwrittenDiagnostics.length;
|
||||
if (num > 0) {
|
||||
logger.warning(
|
||||
`${num} diagnostic(s) could not be written to the database and will not appear on the Tool Status Page.`
|
||||
);
|
||||
for (const unwritten of unwrittenDiagnostics) {
|
||||
logger.debug(JSON.stringify(unwritten.diagnostic));
|
||||
}
|
||||
return void 0;
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
function flushDiagnostics(config) {
|
||||
const logger = getActionsLogger();
|
||||
logger.debug(
|
||||
`Writing ${unwrittenDiagnostics.length} diagnostic(s) to database.`
|
||||
);
|
||||
for (const unwritten of unwrittenDiagnostics) {
|
||||
writeDiagnostic(config, unwritten.language, unwritten.diagnostic);
|
||||
}
|
||||
unwrittenDiagnostics = [];
|
||||
}
|
||||
function makeTelemetryDiagnostic(id, name, attributes) {
|
||||
return makeDiagnostic(id, name, {
|
||||
attributes,
|
||||
visibility: {
|
||||
cliSummaryTable: false,
|
||||
statusPage: false,
|
||||
telemetry: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// src/git-utils.ts
|
||||
var GIT_MINIMUM_VERSION_FOR_OVERLAY = "2.38.0";
|
||||
var cachedGitVersion;
|
||||
async function getGitVersionOrThrow() {
|
||||
const stdout = await runGitCommand(
|
||||
void 0,
|
||||
["--version"],
|
||||
"Failed to get git version."
|
||||
);
|
||||
const match = stdout.match(/git version (\d+\.\d+\.\d+)/);
|
||||
if (match?.[1]) {
|
||||
return match[1];
|
||||
}
|
||||
throw new Error(`Could not parse Git version from output: ${stdout.trim()}`);
|
||||
}
|
||||
async function getGitVersion(logger) {
|
||||
if (cachedGitVersion !== void 0) {
|
||||
return cachedGitVersion;
|
||||
}
|
||||
try {
|
||||
cachedGitVersion = await getGitVersionOrThrow();
|
||||
return cachedGitVersion;
|
||||
} catch (e) {
|
||||
logger.debug(`Could not determine Git version: ${getErrorMessage(e)}`);
|
||||
return void 0;
|
||||
}
|
||||
}
|
||||
async function logGitVersionTelemetry(config, logger) {
|
||||
const version = await getGitVersion(logger);
|
||||
if (version !== void 0) {
|
||||
addDiagnostic(
|
||||
config,
|
||||
config.languages[0],
|
||||
makeTelemetryDiagnostic(
|
||||
"codeql-action/git-version-telemetry",
|
||||
"Git version telemetry",
|
||||
{ gitVersion: version }
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
async function gitVersionAtLeast(requiredVersion, logger) {
|
||||
const version = await getGitVersion();
|
||||
const version = await getGitVersion(logger);
|
||||
if (version === void 0) {
|
||||
logger.debug("Could not determine Git version.");
|
||||
return false;
|
||||
}
|
||||
logger.debug(`Installed Git version is ${version}.`);
|
||||
@@ -85677,7 +85813,7 @@ async function gitVersionAtLeast(requiredVersion, logger) {
|
||||
var runGitCommand = async function(workingDirectory, args, customErrorMessage) {
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
core7.debug(`Running git command: git ${args.join(" ")}`);
|
||||
core8.debug(`Running git command: git ${args.join(" ")}`);
|
||||
try {
|
||||
await new toolrunner2.ToolRunner(await io3.which("git", true), args, {
|
||||
silent: true,
|
||||
@@ -85697,7 +85833,7 @@ var runGitCommand = async function(workingDirectory, args, customErrorMessage) {
|
||||
if (stderr.includes("not a git repository")) {
|
||||
reason = "The checkout path provided to the action does not appear to be a git repository.";
|
||||
}
|
||||
core7.info(`git call failed. ${customErrorMessage} Error: ${reason}`);
|
||||
core8.info(`git call failed. ${customErrorMessage} Error: ${reason}`);
|
||||
throw error3;
|
||||
}
|
||||
};
|
||||
@@ -85820,7 +85956,7 @@ async function getRef() {
|
||||
) !== head;
|
||||
if (hasChangedRef) {
|
||||
const newRef = ref.replace(pull_ref_regex, "refs/pull/$1/head");
|
||||
core7.debug(
|
||||
core8.debug(
|
||||
`No longer on merge commit, rewriting ref from ${ref} to ${newRef}.`
|
||||
);
|
||||
return newRef;
|
||||
@@ -85845,39 +85981,6 @@ async function isAnalyzingDefaultBranch() {
|
||||
return currentRef === defaultBranch;
|
||||
}
|
||||
|
||||
// src/logging.ts
|
||||
var core8 = __toESM(require_core());
|
||||
function getActionsLogger() {
|
||||
return {
|
||||
debug: core8.debug,
|
||||
info: core8.info,
|
||||
warning: core8.warning,
|
||||
error: core8.error,
|
||||
isDebug: core8.isDebug,
|
||||
startGroup: core8.startGroup,
|
||||
endGroup: core8.endGroup
|
||||
};
|
||||
}
|
||||
async function withGroupAsync(groupName, f) {
|
||||
core8.startGroup(groupName);
|
||||
try {
|
||||
return await f();
|
||||
} finally {
|
||||
core8.endGroup();
|
||||
}
|
||||
}
|
||||
function formatDuration(durationMs) {
|
||||
if (durationMs < 1e3) {
|
||||
return `${durationMs}ms`;
|
||||
}
|
||||
if (durationMs < 60 * 1e3) {
|
||||
return `${(durationMs / 1e3).toFixed(1)}s`;
|
||||
}
|
||||
const minutes = Math.floor(durationMs / (60 * 1e3));
|
||||
const seconds = Math.floor(durationMs % (60 * 1e3) / 1e3);
|
||||
return `${minutes}m${seconds}s`;
|
||||
}
|
||||
|
||||
// src/overlay-database-utils.ts
|
||||
var CODEQL_OVERLAY_MINIMUM_VERSION = "2.23.5";
|
||||
var OVERLAY_BASE_DATABASE_MAX_UPLOAD_SIZE_MB = 7500;
|
||||
@@ -85904,7 +86007,7 @@ async function readBaseDatabaseOidsFile(config, logger) {
|
||||
}
|
||||
}
|
||||
function getBaseDatabaseOidsFilePath(config) {
|
||||
return path4.join(config.dbLocation, "base-database-oids.json");
|
||||
return path5.join(config.dbLocation, "base-database-oids.json");
|
||||
}
|
||||
async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
const baseFileOids = await readBaseDatabaseOidsFile(config, logger);
|
||||
@@ -85914,7 +86017,7 @@ async function writeOverlayChangesFile(config, sourceRoot, logger) {
|
||||
`Found ${changedFiles.length} changed file(s) under ${sourceRoot}.`
|
||||
);
|
||||
const changedFilesJson = JSON.stringify({ changes: changedFiles });
|
||||
const overlayChangesFile = path4.join(
|
||||
const overlayChangesFile = path5.join(
|
||||
getTemporaryDirectory(),
|
||||
"overlay-changes.json"
|
||||
);
|
||||
@@ -86301,7 +86404,7 @@ var Features = class {
|
||||
this.gitHubFeatureFlags = new GitHubFeatureFlags(
|
||||
gitHubVersion,
|
||||
repositoryNwo,
|
||||
path5.join(tempDir, FEATURE_FLAGS_FILE_NAME),
|
||||
path6.join(tempDir, FEATURE_FLAGS_FILE_NAME),
|
||||
logger
|
||||
);
|
||||
}
|
||||
@@ -86601,7 +86704,7 @@ var KnownLanguage = /* @__PURE__ */ ((KnownLanguage2) => {
|
||||
|
||||
// src/trap-caching.ts
|
||||
var fs5 = __toESM(require("fs"));
|
||||
var path6 = __toESM(require("path"));
|
||||
var path7 = __toESM(require("path"));
|
||||
var actionsCache2 = __toESM(require_cache3());
|
||||
var CACHE_VERSION2 = 1;
|
||||
var CODEQL_TRAP_CACHE_PREFIX = "codeql-trap";
|
||||
@@ -86617,12 +86720,12 @@ async function downloadTrapCaches(codeql, languages, logger) {
|
||||
`Found ${languagesSupportingCaching.length} languages that support TRAP caching`
|
||||
);
|
||||
if (languagesSupportingCaching.length === 0) return result;
|
||||
const cachesDir = path6.join(
|
||||
const cachesDir = path7.join(
|
||||
getTemporaryDirectory(),
|
||||
"trapCaches"
|
||||
);
|
||||
for (const language of languagesSupportingCaching) {
|
||||
const cacheDir = path6.join(cachesDir, language);
|
||||
const cacheDir = path7.join(cachesDir, language);
|
||||
fs5.mkdirSync(cacheDir, { recursive: true });
|
||||
result[language] = cacheDir;
|
||||
}
|
||||
@@ -86635,7 +86738,7 @@ async function downloadTrapCaches(codeql, languages, logger) {
|
||||
let baseSha = "unknown";
|
||||
const eventPath = process.env.GITHUB_EVENT_PATH;
|
||||
if (getWorkflowEventName() === "pull_request" && eventPath !== void 0) {
|
||||
const event = JSON.parse(fs5.readFileSync(path6.resolve(eventPath), "utf-8"));
|
||||
const event = JSON.parse(fs5.readFileSync(path7.resolve(eventPath), "utf-8"));
|
||||
baseSha = event.pull_request?.base?.sha || baseSha;
|
||||
}
|
||||
for (const language of languages) {
|
||||
@@ -86739,7 +86842,7 @@ async function getSupportedLanguageMap(codeql, logger) {
|
||||
}
|
||||
var baseWorkflowsPath = ".github/workflows";
|
||||
function hasActionsWorkflows(sourceRoot) {
|
||||
const workflowsPath = path7.resolve(sourceRoot, baseWorkflowsPath);
|
||||
const workflowsPath = path8.resolve(sourceRoot, baseWorkflowsPath);
|
||||
const stats = fs6.lstatSync(workflowsPath, { throwIfNoEntry: false });
|
||||
return stats !== void 0 && stats.isDirectory() && fs6.readdirSync(workflowsPath).length > 0;
|
||||
}
|
||||
@@ -86906,8 +87009,8 @@ async function downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logg
|
||||
async function loadUserConfig(logger, configFile, workspacePath, apiDetails, tempDir, validateConfig) {
|
||||
if (isLocal(configFile)) {
|
||||
if (configFile !== userConfigFromActionPath(tempDir)) {
|
||||
configFile = path7.resolve(workspacePath, configFile);
|
||||
if (!(configFile + path7.sep).startsWith(workspacePath + path7.sep)) {
|
||||
configFile = path8.resolve(workspacePath, configFile);
|
||||
if (!(configFile + path8.sep).startsWith(workspacePath + path8.sep)) {
|
||||
throw new ConfigurationError(
|
||||
getConfigFileOutsideWorkspaceErrorMessage(configFile)
|
||||
);
|
||||
@@ -87067,10 +87170,10 @@ async function getOverlayDatabaseMode(codeql, features, languages, sourceRoot, b
|
||||
};
|
||||
}
|
||||
function dbLocationOrDefault(dbLocation, tempDir) {
|
||||
return dbLocation || path7.resolve(tempDir, "codeql_databases");
|
||||
return dbLocation || path8.resolve(tempDir, "codeql_databases");
|
||||
}
|
||||
function userConfigFromActionPath(tempDir) {
|
||||
return path7.resolve(tempDir, "user-config-from-action.yml");
|
||||
return path8.resolve(tempDir, "user-config-from-action.yml");
|
||||
}
|
||||
function hasQueryCustomisation(userConfig) {
|
||||
return isDefined(userConfig["disable-default-queries"]) || isDefined(userConfig.queries) || isDefined(userConfig["query-filters"]);
|
||||
@@ -87210,12 +87313,12 @@ async function getRemoteConfig(logger, configFile, apiDetails, validateConfig) {
|
||||
);
|
||||
}
|
||||
function getPathToParsedConfigFile(tempDir) {
|
||||
return path7.join(tempDir, "config");
|
||||
return path8.join(tempDir, "config");
|
||||
}
|
||||
async function saveConfig(config, logger) {
|
||||
const configString = JSON.stringify(config);
|
||||
const configFile = getPathToParsedConfigFile(config.tempDir);
|
||||
fs6.mkdirSync(path7.dirname(configFile), { recursive: true });
|
||||
fs6.mkdirSync(path8.dirname(configFile), { recursive: true });
|
||||
fs6.writeFileSync(configFile, configString, "utf8");
|
||||
logger.debug("Saved config:");
|
||||
logger.debug(configString);
|
||||
@@ -87226,7 +87329,7 @@ async function generateRegistries(registriesInput, tempDir, logger) {
|
||||
let qlconfigFile;
|
||||
if (registries) {
|
||||
const qlconfig = createRegistriesBlock(registries);
|
||||
qlconfigFile = path7.join(tempDir, "qlconfig.yml");
|
||||
qlconfigFile = path8.join(tempDir, "qlconfig.yml");
|
||||
const qlconfigContents = dump(qlconfig);
|
||||
fs6.writeFileSync(qlconfigFile, qlconfigContents, "utf8");
|
||||
logger.debug("Generated qlconfig.yml:");
|
||||
@@ -87327,31 +87430,31 @@ function isCodeQualityEnabled(config) {
|
||||
|
||||
// src/dependency-caching.ts
|
||||
var os2 = __toESM(require("os"));
|
||||
var import_path = require("path");
|
||||
var import_path2 = require("path");
|
||||
var actionsCache3 = __toESM(require_cache3());
|
||||
var glob = __toESM(require_glob2());
|
||||
var CODEQL_DEPENDENCY_CACHE_PREFIX = "codeql-dependencies";
|
||||
var CODEQL_DEPENDENCY_CACHE_VERSION = 1;
|
||||
function getJavaTempDependencyDir() {
|
||||
return (0, import_path.join)(getTemporaryDirectory(), "codeql_java", "repository");
|
||||
return (0, import_path2.join)(getTemporaryDirectory(), "codeql_java", "repository");
|
||||
}
|
||||
async function getJavaDependencyDirs() {
|
||||
return [
|
||||
// Maven
|
||||
(0, import_path.join)(os2.homedir(), ".m2", "repository"),
|
||||
(0, import_path2.join)(os2.homedir(), ".m2", "repository"),
|
||||
// Gradle
|
||||
(0, import_path.join)(os2.homedir(), ".gradle", "caches"),
|
||||
(0, import_path2.join)(os2.homedir(), ".gradle", "caches"),
|
||||
// CodeQL Java build-mode: none
|
||||
getJavaTempDependencyDir()
|
||||
];
|
||||
}
|
||||
function getCsharpTempDependencyDir() {
|
||||
return (0, import_path.join)(getTemporaryDirectory(), "codeql_csharp", "repository");
|
||||
return (0, import_path2.join)(getTemporaryDirectory(), "codeql_csharp", "repository");
|
||||
}
|
||||
async function getCsharpDependencyDirs(codeql, features) {
|
||||
const dirs = [
|
||||
// Nuget
|
||||
(0, import_path.join)(os2.homedir(), ".nuget", "packages")
|
||||
(0, import_path2.join)(os2.homedir(), ".nuget", "packages")
|
||||
];
|
||||
if (await features.getValue("csharp_cache_bmn" /* CsharpCacheBuildModeNone */, codeql)) {
|
||||
dirs.push(getCsharpTempDependencyDir());
|
||||
@@ -87406,7 +87509,7 @@ var defaultCacheConfigs = {
|
||||
getHashPatterns: getCsharpHashPatterns
|
||||
},
|
||||
go: {
|
||||
getDependencyPaths: async () => [(0, import_path.join)(os2.homedir(), "go", "pkg", "mod")],
|
||||
getDependencyPaths: async () => [(0, import_path2.join)(os2.homedir(), "go", "pkg", "mod")],
|
||||
getHashPatterns: async () => internal.makePatternCheck(["**/go.sum"])
|
||||
}
|
||||
};
|
||||
@@ -87526,73 +87629,6 @@ var internal = {
|
||||
makePatternCheck
|
||||
};
|
||||
|
||||
// src/diagnostics.ts
|
||||
var import_fs = require("fs");
|
||||
var import_path2 = __toESM(require("path"));
|
||||
var unwrittenDiagnostics = [];
|
||||
function makeDiagnostic(id, name, data = void 0) {
|
||||
return {
|
||||
...data,
|
||||
timestamp: data?.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
||||
source: { ...data?.source, id, name }
|
||||
};
|
||||
}
|
||||
function addDiagnostic(config, language, diagnostic) {
|
||||
const logger = getActionsLogger();
|
||||
const databasePath = language ? getCodeQLDatabasePath(config, language) : config.dbLocation;
|
||||
if ((0, import_fs.existsSync)(databasePath)) {
|
||||
writeDiagnostic(config, language, diagnostic);
|
||||
} else {
|
||||
logger.debug(
|
||||
`Writing a diagnostic for ${language}, but the database at ${databasePath} does not exist yet.`
|
||||
);
|
||||
unwrittenDiagnostics.push({ diagnostic, language });
|
||||
}
|
||||
}
|
||||
function writeDiagnostic(config, language, diagnostic) {
|
||||
const logger = getActionsLogger();
|
||||
const databasePath = language ? getCodeQLDatabasePath(config, language) : config.dbLocation;
|
||||
const diagnosticsPath = import_path2.default.resolve(
|
||||
databasePath,
|
||||
"diagnostic",
|
||||
"codeql-action"
|
||||
);
|
||||
try {
|
||||
(0, import_fs.mkdirSync)(diagnosticsPath, { recursive: true });
|
||||
const jsonPath = import_path2.default.resolve(
|
||||
diagnosticsPath,
|
||||
// Remove colons from the timestamp as these are not allowed in Windows filenames.
|
||||
`codeql-action-${diagnostic.timestamp.replaceAll(":", "")}.json`
|
||||
);
|
||||
(0, import_fs.writeFileSync)(jsonPath, JSON.stringify(diagnostic));
|
||||
} catch (err) {
|
||||
logger.warning(`Unable to write diagnostic message to database: ${err}`);
|
||||
logger.debug(JSON.stringify(diagnostic));
|
||||
}
|
||||
}
|
||||
function logUnwrittenDiagnostics() {
|
||||
const logger = getActionsLogger();
|
||||
const num = unwrittenDiagnostics.length;
|
||||
if (num > 0) {
|
||||
logger.warning(
|
||||
`${num} diagnostic(s) could not be written to the database and will not appear on the Tool Status Page.`
|
||||
);
|
||||
for (const unwritten of unwrittenDiagnostics) {
|
||||
logger.debug(JSON.stringify(unwritten.diagnostic));
|
||||
}
|
||||
}
|
||||
}
|
||||
function flushDiagnostics(config) {
|
||||
const logger = getActionsLogger();
|
||||
logger.debug(
|
||||
`Writing ${unwrittenDiagnostics.length} diagnostic(s) to database.`
|
||||
);
|
||||
for (const unwritten of unwrittenDiagnostics) {
|
||||
writeDiagnostic(config, unwritten.language, unwritten.diagnostic);
|
||||
}
|
||||
unwrittenDiagnostics = [];
|
||||
}
|
||||
|
||||
// src/init.ts
|
||||
var fs12 = __toESM(require("fs"));
|
||||
var path13 = __toESM(require("path"));
|
||||
@@ -90170,6 +90206,7 @@ async function run() {
|
||||
)
|
||||
);
|
||||
}
|
||||
await logGitVersionTelemetry(config, logger);
|
||||
const goFlags = process.env["GOFLAGS"];
|
||||
if (goFlags) {
|
||||
core13.exportVariable("GOFLAGS", goFlags);
|
||||
|
||||
Reference in New Issue
Block a user