Skip to content

Commit

Permalink
feat: more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nyarthan committed Mar 13, 2024
1 parent ea1eceb commit ff6bf4e
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 70 deletions.
147 changes: 77 additions & 70 deletions dist/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -763,18 +763,18 @@ var require_tunnel = __commonJS({
res.statusCode
);
socket.destroy();
var error = new Error("tunneling socket could not be established, statusCode=" + res.statusCode);
error.code = "ECONNRESET";
options.request.emit("error", error);
var error2 = new Error("tunneling socket could not be established, statusCode=" + res.statusCode);
error2.code = "ECONNRESET";
options.request.emit("error", error2);
self.removeSocket(placeholder);
return;
}
if (head.length > 0) {
debug("got illegal response body from proxy");
socket.destroy();
var error = new Error("got illegal response body from proxy");
error.code = "ECONNRESET";
options.request.emit("error", error);
var error2 = new Error("got illegal response body from proxy");
error2.code = "ECONNRESET";
options.request.emit("error", error2);
self.removeSocket(placeholder);
return;
}
Expand All @@ -789,9 +789,9 @@ var require_tunnel = __commonJS({
cause.message,
cause.stack
);
var error = new Error("tunneling socket could not be established, cause=" + cause.message);
error.code = "ECONNRESET";
options.request.emit("error", error);
var error2 = new Error("tunneling socket could not be established, cause=" + cause.message);
error2.code = "ECONNRESET";
options.request.emit("error", error2);
self.removeSocket(placeholder);
}
};
Expand Down Expand Up @@ -1632,12 +1632,12 @@ var require_oidc_utils = __commonJS({
var _a;
return __awaiter(this, void 0, void 0, function* () {
const httpclient = _OidcClient.createHttpClient();
const res = yield httpclient.getJson(id_token_url).catch((error) => {
const res = yield httpclient.getJson(id_token_url).catch((error2) => {
throw new Error(`Failed to get ID Token.

Error Code : ${error.statusCode}
Error Code : ${error2.statusCode}

Error Message: ${error.message}`);
Error Message: ${error2.message}`);
});
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
if (!id_token) {
Expand All @@ -1658,8 +1658,8 @@ var require_oidc_utils = __commonJS({
const id_token = yield _OidcClient.getCall(id_token_url);
core_1.setSecret(id_token);
return id_token;
} catch (error) {
throw new Error(`Error message: ${error.message}`);
} catch (error2) {
throw new Error(`Error message: ${error2.message}`);
}
});
}
Expand Down Expand Up @@ -2154,7 +2154,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
exports.setCommandEcho = setCommandEcho;
function setFailed2(message) {
process.exitCode = ExitCode.Failure;
error(message);
error2(message);
}
exports.setFailed = setFailed2;
function isDebug() {
Expand All @@ -2165,10 +2165,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
command_1.issueCommand("debug", {}, message);
}
exports.debug = debug;
function error(message, properties = {}) {
function error2(message, properties = {}) {
command_1.issueCommand("error", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
}
exports.error = error;
exports.error = error2;
function warning(message, properties = {}) {
command_1.issueCommand("warning", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
}
Expand Down Expand Up @@ -4394,16 +4394,16 @@ var require_toolrunner = __commonJS({
this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
state.CheckComplete();
});
state.on("done", (error, exitCode) => {
state.on("done", (error2, exitCode) => {
if (stdbuffer.length > 0) {
this.emit("stdline", stdbuffer);
}
if (errbuffer.length > 0) {
this.emit("errline", errbuffer);
}
cp.removeAllListeners();
if (error) {
reject(error);
if (error2) {
reject(error2);
} else {
resolve2(exitCode);
}
Expand Down Expand Up @@ -4498,22 +4498,22 @@ var require_toolrunner = __commonJS({
this.emit("debug", message);
}
_setResult() {
let error;
let error2;
if (this.processExited) {
if (this.processError) {
error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
error2 = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
} else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
error2 = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
} else if (this.processStderr && this.options.failOnStdErr) {
error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
error2 = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
}
}
if (this.timeout) {
clearTimeout(this.timeout);
this.timeout = null;
}
this.done = true;
this.emit("done", error, this.processExitCode);
this.emit("done", error2, this.processExitCode);
}
static HandleTimeout(state) {
if (state.done) {
Expand Down Expand Up @@ -5633,8 +5633,8 @@ var require_directives = __commonJS({
if (prefix) {
try {
return prefix + decodeURIComponent(suffix);
} catch (error) {
onError(String(error));
} catch (error2) {
onError(String(error2));
return null;
}
}
Expand Down Expand Up @@ -5737,9 +5737,9 @@ var require_anchors = __commonJS({
if (typeof ref === "object" && ref.anchor && (identity.isScalar(ref.node) || identity.isCollection(ref.node))) {
ref.node.anchor = ref.anchor;
} else {
const error = new Error("Failed to resolve repeated object (this should not happen)");
error.source = source;
throw error;
const error2 = new Error("Failed to resolve repeated object (this should not happen)");
error2.source = source;
throw error2;
}
}
},
Expand Down Expand Up @@ -8907,12 +8907,12 @@ var require_errors = __commonJS({
super("YAMLWarning", pos, code, message);
}
};
var prettifyError = (src, lc) => (error) => {
if (error.pos[0] === -1)
var prettifyError = (src, lc) => (error2) => {
if (error2.pos[0] === -1)
return;
error.linePos = error.pos.map((pos) => lc.linePos(pos));
const { line, col } = error.linePos[0];
error.message += ` at line ${line}, column ${col}`;
error2.linePos = error2.pos.map((pos) => lc.linePos(pos));
const { line, col } = error2.linePos[0];
error2.message += ` at line ${line}, column ${col}`;
let ci = col - 1;
let lineStr = src.substring(lc.lineStarts[line - 1], lc.lineStarts[line]).replace(/[\n\r]+$/, "");
if (ci >= 60 && lineStr.length > 80) {
Expand All @@ -8930,12 +8930,12 @@ var require_errors = __commonJS({
}
if (/[^ ]/.test(lineStr)) {
let count = 1;
const end = error.linePos[1];
const end = error2.linePos[1];
if (end && end.line === line && end.col > col) {
count = Math.max(1, Math.min(end.col - col, 80 - ci));
}
const pointer = " ".repeat(ci) + "^".repeat(count);
error.message += `:
error2.message += `:

${lineStr}
${pointer}
Expand Down Expand Up @@ -9701,7 +9701,7 @@ var require_resolve_block_scalar = __commonJS({
const mode = source[0];
let indent = 0;
let chomp = "";
let error = -1;
let error2 = -1;
for (let i = 1; i < source.length; ++i) {
const ch = source[i];
if (!chomp && (ch === "-" || ch === "+"))
Expand All @@ -9710,12 +9710,12 @@ var require_resolve_block_scalar = __commonJS({
const n = Number(ch);
if (!indent && n)
indent = n;
else if (error === -1)
error = offset + i;
else if (error2 === -1)
error2 = offset + i;
}
}
if (error !== -1)
onError(error, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${source}`);
if (error2 !== -1)
onError(error2, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${source}`);
let hasSpace = false;
let comment = "";
let length = source.length;
Expand Down Expand Up @@ -9997,8 +9997,8 @@ var require_compose_scalar = __commonJS({
try {
const res = tag.resolve(value, (msg) => onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg), ctx.options);
scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);
} catch (error) {
const msg = error instanceof Error ? error.message : String(error);
} catch (error2) {
const msg = error2 instanceof Error ? error2.message : String(error2);
onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
scalar = new Scalar.Scalar(value);
}
Expand Down Expand Up @@ -10372,11 +10372,11 @@ ${cb}` : comment;
break;
case "error": {
const msg = token.source ? `${token.message}: ${JSON.stringify(token.source)}` : token.message;
const error = new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg);
const error2 = new errors.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg);
if (this.atDirectives || !this.doc)
this.errors.push(error);
this.errors.push(error2);
else
this.doc.errors.push(error);
this.doc.errors.push(error2);
break;
}
case "doc-end": {
Expand Down Expand Up @@ -11655,8 +11655,8 @@ var require_parser = __commonJS({
peek(n) {
return this.stack[this.stack.length - n];
}
*pop(error) {
const token = error ?? this.stack.pop();
*pop(error2) {
const token = error2 ?? this.stack.pop();
if (!token) {
const message = "Tried to pop an empty stack";
yield { type: "error", offset: this.offset, source: "", message };
Expand Down Expand Up @@ -12559,7 +12559,7 @@ var require_parser2 = __commonJS({
peg$reportedPos
);
}
function error(message) {
function error2(message) {
throw peg$buildException(message, null, peg$reportedPos);
}
function peg$computePosDetails(pos) {
Expand Down Expand Up @@ -18847,8 +18847,8 @@ var ZodError = class extends Error {
return issue.message;
};
const fieldErrors = { _errors: [] };
const processError = (error) => {
for (const issue of error.issues) {
const processError = (error2) => {
for (const issue of error2.issues) {
if (issue.code === "invalid_union") {
issue.unionErrors.map(processError);
} else if (issue.code === "invalid_return_type") {
Expand Down Expand Up @@ -18905,8 +18905,8 @@ var ZodError = class extends Error {
}
};
ZodError.create = (issues) => {
const error = new ZodError(issues);
return error;
const error2 = new ZodError(issues);
return error2;
};
var errorMap = (issue, _ctx) => {
let message;
Expand Down Expand Up @@ -19140,8 +19140,8 @@ var handleResult = (ctx, result) => {
get error() {
if (this._error)
return this._error;
const error = new ZodError(ctx.common.issues);
this._error = error;
const error2 = new ZodError(ctx.common.issues);
this._error = error2;
return this._error;
}
};
Expand Down Expand Up @@ -21557,7 +21557,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
});
return INVALID;
}
function makeArgsIssue(args, error) {
function makeArgsIssue(args, error2) {
return makeIssue({
data: args,
path: ctx.path,
Expand All @@ -21569,11 +21569,11 @@ var ZodFunction = class _ZodFunction extends ZodType {
].filter((x) => !!x),
issueData: {
code: ZodIssueCode.invalid_arguments,
argumentsError: error
argumentsError: error2
}
});
}
function makeReturnsIssue(returns, error) {
function makeReturnsIssue(returns, error2) {
return makeIssue({
data: returns,
path: ctx.path,
Expand All @@ -21585,7 +21585,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
].filter((x) => !!x),
issueData: {
code: ZodIssueCode.invalid_return_type,
returnTypeError: error
returnTypeError: error2
}
});
}
Expand All @@ -21594,15 +21594,15 @@ var ZodFunction = class _ZodFunction extends ZodType {
if (this._def.returns instanceof ZodPromise) {
const me = this;
return OK(async function(...args) {
const error = new ZodError([]);
const error2 = new ZodError([]);
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
error.addIssue(makeArgsIssue(args, e));
throw error;
error2.addIssue(makeArgsIssue(args, e));
throw error2;
});
const result = await Reflect.apply(fn, this, parsedArgs);
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
error.addIssue(makeReturnsIssue(result, e));
throw error;
error2.addIssue(makeReturnsIssue(result, e));
throw error2;
});
return parsedReturns;
});
Expand Down Expand Up @@ -22275,8 +22275,15 @@ async function getVersionFromConfigFile() {
for (const file of files) {
const currentPath = path.join(process.env["GITHUB_WORKSPACE"] ?? process.cwd(), file);
const files2 = await fsp.readdir(process.env["GITHUB_WORKSPACE"] ?? process.cwd());
core.info("GITHUB_WORKSPACE: " + process.env["GITHUB_WORKSPACE"]);
core.info(JSON.stringify(files2));
core.info(`Path: ${currentPath}`);
try {
const files3 = await fsp.readdir(process.env["GITHUB_WORKSPACE"] ?? process.cwd());
core.info("Files: " + files3);
} catch (error2) {
core.error("Error reading directory: " + error2);
}
try {
const stat2 = await fsp.stat(currentPath);
if (stat2.isFile()) {
Expand Down Expand Up @@ -22318,8 +22325,8 @@ function getLibcVersion() {
} else if (output.includes("musl libc")) {
return "musl";
}
} catch (error) {
console.error("Failed to determine libc version:", error);
} catch (error2) {
console.error("Failed to determine libc version:", error2);
}
return "";
}
Expand Down Expand Up @@ -22377,7 +22384,7 @@ async function downloadFile(fileURL, destination) {
}
const fileStream = fs.createWriteStream(destination);
return new Promise(
(resolve2, reject) => response.message.pipe(fileStream).on("close", () => resolve2(destination)).on("error", (error) => reject(error))
(resolve2, reject) => response.message.pipe(fileStream).on("close", () => resolve2(destination)).on("error", (error2) => reject(error2))
);
}
async function unzipArchive(archive, destination = __dirname2, deleteAfter = false) {
Expand Down Expand Up @@ -22408,8 +22415,8 @@ async function run() {
const binaryPath = path.join(toolDir, "bwenv");
await fsp.chmod(binaryPath, "755");
core.addPath(toolDir);
} catch (error) {
core.setFailed(error.message);
} catch (error2) {
core.setFailed(error2.message);
}
}
run();
Loading

0 comments on commit ff6bf4e

Please sign in to comment.