mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Use runInActions for start-proxy
This commit is contained in:
38
lib/entry-points.js
generated
38
lib/entry-points.js
generated
@@ -21567,7 +21567,7 @@ var require_core = __commonJS({
|
||||
exports2.getBooleanInput = getBooleanInput;
|
||||
exports2.setOutput = setOutput7;
|
||||
exports2.setCommandEcho = setCommandEcho;
|
||||
exports2.setFailed = setFailed13;
|
||||
exports2.setFailed = setFailed12;
|
||||
exports2.isDebug = isDebug5;
|
||||
exports2.debug = debug6;
|
||||
exports2.error = error3;
|
||||
@@ -21651,7 +21651,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
||||
function setCommandEcho(enabled) {
|
||||
(0, command_1.issue)("echo", enabled ? "on" : "off");
|
||||
}
|
||||
function setFailed13(message) {
|
||||
function setFailed12(message) {
|
||||
process.exitCode = ExitCode.Failure;
|
||||
error3(message);
|
||||
}
|
||||
@@ -121094,11 +121094,11 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
||||
(0, command_1.issue)("echo", enabled ? "on" : "off");
|
||||
}
|
||||
exports2.setCommandEcho = setCommandEcho;
|
||||
function setFailed13(message) {
|
||||
function setFailed12(message) {
|
||||
process.exitCode = ExitCode.Failure;
|
||||
error3(message);
|
||||
}
|
||||
exports2.setFailed = setFailed13;
|
||||
exports2.setFailed = setFailed12;
|
||||
function isDebug5() {
|
||||
return process.env["RUNNER_DEBUG"] === "1";
|
||||
}
|
||||
@@ -162654,17 +162654,12 @@ async function checkConnections(logger, proxy, backend) {
|
||||
}
|
||||
|
||||
// src/start-proxy-action.ts
|
||||
async function run7(startedAt) {
|
||||
const logger = getActionsLogger();
|
||||
async function run7(action) {
|
||||
const startedAt = action.startedAt;
|
||||
const logger = action.logger;
|
||||
let features;
|
||||
let language;
|
||||
try {
|
||||
const action = {
|
||||
logger,
|
||||
env: getEnv(),
|
||||
actions: getActionsEnv()
|
||||
};
|
||||
getJobUUID(action);
|
||||
persistInputs();
|
||||
const tempDir = getTemporaryDirectory();
|
||||
const proxyLogFilePath = path28.resolve(tempDir, "proxy.log");
|
||||
@@ -162727,20 +162722,13 @@ async function run7(startedAt) {
|
||||
await sendFailedStatusReport(logger, startedAt, language, unwrappedError);
|
||||
}
|
||||
}
|
||||
var startProxyAction = {
|
||||
name: "start-proxy" /* StartProxy */,
|
||||
run: run7,
|
||||
transformTelemetryError: getSafeErrorMessage
|
||||
};
|
||||
async function runWrapper8() {
|
||||
const startedAt = /* @__PURE__ */ new Date();
|
||||
const logger = getActionsLogger();
|
||||
try {
|
||||
await run7(startedAt);
|
||||
} catch (error3) {
|
||||
core27.setFailed(`start-proxy action failed: ${getErrorMessage(error3)}`);
|
||||
await sendUnhandledErrorStatusReport(
|
||||
"start-proxy" /* StartProxy */,
|
||||
startedAt,
|
||||
getSafeErrorMessage(wrapError(error3)),
|
||||
logger
|
||||
);
|
||||
}
|
||||
await runInActions(startProxyAction);
|
||||
}
|
||||
async function startProxy(binPath, config, logFilePath, logger) {
|
||||
const host = "127.0.0.1";
|
||||
|
||||
@@ -3,12 +3,12 @@ import * as path from "path";
|
||||
|
||||
import * as core from "@actions/core";
|
||||
|
||||
import { ActionState } from "./action-common";
|
||||
import { Action, ActionState, runInActions } from "./action-common";
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import { getGitHubVersion } from "./api-client";
|
||||
import { FeatureEnablement, initFeatures } from "./feature-flags";
|
||||
import { BuiltInLanguage, parseBuiltInLanguage } from "./languages";
|
||||
import { getActionsLogger, Logger } from "./logging";
|
||||
import { Logger } from "./logging";
|
||||
import { getRepositoryNwo } from "./repository";
|
||||
import {
|
||||
credentialToStr,
|
||||
@@ -24,31 +24,18 @@ import {
|
||||
import { generateCertificateAuthority } from "./start-proxy/ca";
|
||||
import { checkProxyEnvironment } from "./start-proxy/environment";
|
||||
import { checkConnections } from "./start-proxy/reachability";
|
||||
import {
|
||||
ActionName,
|
||||
getJobUUID,
|
||||
sendUnhandledErrorStatusReport,
|
||||
} from "./status-report";
|
||||
import { ActionName } from "./status-report";
|
||||
import * as util from "./util";
|
||||
|
||||
async function run(startedAt: Date) {
|
||||
async function run(action: ActionState<["Base", "Logger", "Env", "Actions"]>) {
|
||||
// To capture errors appropriately, keep as much code within the try-catch as
|
||||
// possible, and only use safe functions outside.
|
||||
|
||||
const logger = getActionsLogger();
|
||||
const startedAt = action.startedAt;
|
||||
const logger = action.logger;
|
||||
let features: FeatureEnablement | undefined;
|
||||
let language: BuiltInLanguage | undefined;
|
||||
|
||||
try {
|
||||
const action: ActionState<["Logger", "Env", "Actions"]> = {
|
||||
logger,
|
||||
env: util.getEnv(),
|
||||
actions: actionsUtil.getActionsEnv(),
|
||||
};
|
||||
|
||||
// Create a unique identifier for this run.
|
||||
getJobUUID(action);
|
||||
|
||||
// Make inputs accessible in the `post` step.
|
||||
actionsUtil.persistInputs();
|
||||
|
||||
@@ -136,21 +123,15 @@ async function run(startedAt: Date) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function runWrapper() {
|
||||
const startedAt = new Date();
|
||||
const logger = getActionsLogger();
|
||||
/** Defines the `start-proxy` Action. */
|
||||
const startProxyAction: Action = {
|
||||
name: ActionName.StartProxy,
|
||||
run,
|
||||
transformTelemetryError: getSafeErrorMessage,
|
||||
};
|
||||
|
||||
try {
|
||||
await run(startedAt);
|
||||
} catch (error) {
|
||||
core.setFailed(`start-proxy action failed: ${util.getErrorMessage(error)}`);
|
||||
await sendUnhandledErrorStatusReport(
|
||||
ActionName.StartProxy,
|
||||
startedAt,
|
||||
getSafeErrorMessage(util.wrapError(error)),
|
||||
logger,
|
||||
);
|
||||
}
|
||||
export async function runWrapper() {
|
||||
await runInActions(startProxyAction);
|
||||
}
|
||||
|
||||
async function startProxy(
|
||||
|
||||
Reference in New Issue
Block a user