From 088ca92b3f4d7db1e939f1a4cdad623fc5925433 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Fri, 6 Jun 2025 17:27:46 +1000 Subject: [PATCH 1/5] chore: log action result --- .editorconfig-checker | 2 +- dist/index.js | 288 ++++++++++++++++++++++-------------------- src/main.ts | 34 ++++- 3 files changed, 183 insertions(+), 141 deletions(-) diff --git a/.editorconfig-checker b/.editorconfig-checker index 5f0d6aa..05ed3e2 100644 --- a/.editorconfig-checker +++ b/.editorconfig-checker @@ -1,5 +1,5 @@ { - "Version": "v3.2.0", + "Version": "v3.3.0", "Verbose": false, "Debug": false, "IgnoreDefaults": false, diff --git a/dist/index.js b/dist/index.js index 0f31ab3..b9c7ba3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -748,18 +748,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; } @@ -774,9 +774,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); } }; @@ -5901,7 +5901,7 @@ Content-Type: ${value.type || "application/octet-stream"}\r throw new TypeError("Body is unusable"); } const promise = createDeferredPromise(); - const errorSteps = (error) => promise.reject(error); + const errorSteps = (error2) => promise.reject(error2); const successSteps = (data) => { try { promise.resolve(convertBytesToJSValue(data)); @@ -6187,16 +6187,16 @@ var require_request = __commonJS({ this.onError(err); } } - onError(error) { + onError(error2) { this.onFinally(); if (channels.error.hasSubscribers) { - channels.error.publish({ request: this, error }); + channels.error.publish({ request: this, error: error2 }); } if (this.aborted) { return; } this.aborted = true; - return this[kHandler].onError(error); + return this[kHandler].onError(error2); } onFinally() { if (this.errorHandler) { @@ -7068,8 +7068,8 @@ var require_RedirectHandler = __commonJS({ onUpgrade(statusCode, headers, socket) { this.handler.onUpgrade(statusCode, headers, socket); } - onError(error) { - this.handler.onError(error); + onError(error2) { + this.handler.onError(error2); } onHeaders(statusCode, headers, resume, statusText) { this.location = this.history.length >= this.maxRedirections || util2.isDisturbed(this.opts.body) ? null : parseLocation(statusCode, headers); @@ -10815,13 +10815,13 @@ var require_mock_utils = __commonJS({ if (mockDispatch2.data.callback) { mockDispatch2.data = { ...mockDispatch2.data, ...mockDispatch2.data.callback(opts) }; } - const { data: { statusCode, data, headers, trailers, error }, delay, persist } = mockDispatch2; + const { data: { statusCode, data, headers, trailers, error: error2 }, delay, persist } = mockDispatch2; const { timesInvoked, times } = mockDispatch2; mockDispatch2.consumed = !persist && timesInvoked >= times; mockDispatch2.pending = timesInvoked < times; - if (error !== null) { + if (error2 !== null) { deleteMockDispatch(this[kDispatches], key); - handler.onError(error); + handler.onError(error2); return true; } if (typeof delay === "number" && delay > 0) { @@ -10859,19 +10859,19 @@ var require_mock_utils = __commonJS({ if (agent.isMockActive) { try { mockDispatch.call(this, opts, handler); - } catch (error) { - if (error instanceof MockNotMatchedError) { + } catch (error2) { + if (error2 instanceof MockNotMatchedError) { const netConnect = agent[kGetNetConnect](); if (netConnect === false) { - throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`); + throw new MockNotMatchedError(`${error2.message}: subsequent request to origin ${origin} was not allowed (net.connect disabled)`); } if (checkNetConnect(netConnect, origin)) { originalDispatch.call(this, opts, handler); } else { - throw new MockNotMatchedError(`${error.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`); + throw new MockNotMatchedError(`${error2.message}: subsequent request to origin ${origin} was not allowed (net.connect is not enabled for this origin)`); } } else { - throw error; + throw error2; } } } else { @@ -11034,11 +11034,11 @@ var require_mock_interceptor = __commonJS({ /** * Mock an undici request with a defined error. */ - replyWithError(error) { - if (typeof error === "undefined") { + replyWithError(error2) { + if (typeof error2 === "undefined") { throw new InvalidArgumentError("error must be defined"); } - const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error }); + const newMockDispatch = addMockDispatch(this[kDispatches], this[kDispatchKey], { error: error2 }); return new MockScope(newMockDispatch); } /** @@ -13364,17 +13364,17 @@ var require_fetch = __commonJS({ this.emit("terminated", reason); } // https://fetch.spec.whatwg.org/#fetch-controller-abort - abort(error) { + abort(error2) { if (this.state !== "ongoing") { return; } this.state = "aborted"; - if (!error) { - error = new DOMException2("The operation was aborted.", "AbortError"); + if (!error2) { + error2 = new DOMException2("The operation was aborted.", "AbortError"); } - this.serializedAbortReason = error; - this.connection?.destroy(error); - this.emit("terminated", error); + this.serializedAbortReason = error2; + this.connection?.destroy(error2); + this.emit("terminated", error2); } }; function fetch(input, init = {}) { @@ -13478,13 +13478,13 @@ var require_fetch = __commonJS({ performance.markResourceTiming(timingInfo, originalURL.href, initiatorType, globalThis2, cacheState); } } - function abortFetch(p, request, responseObject, error) { - if (!error) { - error = new DOMException2("The operation was aborted.", "AbortError"); + function abortFetch(p, request, responseObject, error2) { + if (!error2) { + error2 = new DOMException2("The operation was aborted.", "AbortError"); } - p.reject(error); + p.reject(error2); if (request.body != null && isReadable(request.body?.stream)) { - request.body.stream.cancel(error).catch((err) => { + request.body.stream.cancel(error2).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -13496,7 +13496,7 @@ var require_fetch = __commonJS({ } const response = responseObject[kState]; if (response.body != null && isReadable(response.body?.stream)) { - response.body.stream.cancel(error).catch((err) => { + response.body.stream.cancel(error2).catch((err) => { if (err.code === "ERR_INVALID_STATE") { return; } @@ -14276,13 +14276,13 @@ var require_fetch = __commonJS({ fetchParams.controller.ended = true; this.body.push(null); }, - onError(error) { + onError(error2) { if (this.abort) { fetchParams.controller.off("terminated", this.abort); } - this.body?.destroy(error); - fetchParams.controller.terminate(error); - reject(error); + this.body?.destroy(error2); + fetchParams.controller.terminate(error2); + reject(error2); }, onUpgrade(status, headersList, socket) { if (status !== 101) { @@ -14748,8 +14748,8 @@ var require_util4 = __commonJS({ } fr[kResult] = result; fireAProgressEvent("load", fr); - } catch (error) { - fr[kError] = error; + } catch (error2) { + fr[kError] = error2; fireAProgressEvent("error", fr); } if (fr[kState] !== "loading") { @@ -14758,13 +14758,13 @@ var require_util4 = __commonJS({ }); break; } - } catch (error) { + } catch (error2) { if (fr[kAborted]) { return; } queueMicrotask(() => { fr[kState] = "done"; - fr[kError] = error; + fr[kError] = error2; fireAProgressEvent("error", fr); if (fr[kState] !== "loading") { fireAProgressEvent("loadend", fr); @@ -16780,11 +16780,11 @@ var require_connection = __commonJS({ }); } } - function onSocketError(error) { + function onSocketError(error2) { const { ws } = this; ws[kReadyState] = states.CLOSING; if (channels.socketError.hasSubscribers) { - channels.socketError.publish(error); + channels.socketError.publish(error2); } this.destroy(); } @@ -18424,12 +18424,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) { @@ -18450,8 +18450,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}`); } }); } @@ -18944,11 +18944,11 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); command_1.issue("echo", enabled ? "on" : "off"); } exports2.setCommandEcho = setCommandEcho; - function setFailed3(message) { + function setFailed4(message) { process.exitCode = ExitCode.Failure; - error(message); + error2(message); } - exports2.setFailed = setFailed3; + exports2.setFailed = setFailed4; function isDebug() { return process.env["RUNNER_DEBUG"] === "1"; } @@ -18957,10 +18957,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); command_1.issueCommand("debug", {}, message); } exports2.debug = debug; - function error(message, properties = {}) { + function error2(message, properties = {}) { command_1.issueCommand("error", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } - exports2.error = error; + exports2.error = error2; function warning2(message, properties = {}) { command_1.issueCommand("warning", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } @@ -18973,22 +18973,22 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); process.stdout.write(message + os.EOL); } exports2.info = info4; - function startGroup3(name) { + function startGroup4(name) { command_1.issue("group", name); } - exports2.startGroup = startGroup3; - function endGroup3() { + exports2.startGroup = startGroup4; + function endGroup4() { command_1.issue("endgroup"); } - exports2.endGroup = endGroup3; + exports2.endGroup = endGroup4; function group(name, fn) { return __awaiter(this, void 0, void 0, function* () { - startGroup3(name); + startGroup4(name); let result; try { result = yield fn(); } finally { - endGroup3(); + endGroup4(); } return result; }); @@ -19265,8 +19265,8 @@ var require_add = __commonJS({ } if (kind === "error") { hook = function(method, options) { - return Promise.resolve().then(method.bind(null, options)).catch(function(error) { - return orig(error, options); + return Promise.resolve().then(method.bind(null, options)).catch(function(error2) { + return orig(error2, options); }); }; } @@ -19999,7 +19999,7 @@ var require_dist_node5 = __commonJS({ } if (status >= 400) { const data = await getResponseData(response); - const error = new import_request_error.RequestError(toErrorMessage(data), status, { + const error2 = new import_request_error.RequestError(toErrorMessage(data), status, { response: { url, status, @@ -20008,7 +20008,7 @@ var require_dist_node5 = __commonJS({ }, request: requestOptions }); - throw error; + throw error2; } return parseSuccessResponseBody ? await getResponseData(response) : response.body; }).then((data) => { @@ -20018,17 +20018,17 @@ var require_dist_node5 = __commonJS({ headers, data }; - }).catch((error) => { - if (error instanceof import_request_error.RequestError) - throw error; - else if (error.name === "AbortError") - throw error; - let message = error.message; - if (error.name === "TypeError" && "cause" in error) { - if (error.cause instanceof Error) { - message = error.cause.message; - } else if (typeof error.cause === "string") { - message = error.cause; + }).catch((error2) => { + if (error2 instanceof import_request_error.RequestError) + throw error2; + else if (error2.name === "AbortError") + throw error2; + let message = error2.message; + if (error2.name === "TypeError" && "cause" in error2) { + if (error2.cause instanceof Error) { + message = error2.cause.message; + } else if (typeof error2.cause === "string") { + message = error2.cause; } } throw new import_request_error.RequestError(message, 500, { @@ -22694,9 +22694,9 @@ var require_dist_node10 = __commonJS({ /<([^>]+)>;\s*rel="next"/ ) || [])[1]; return { value: normalizedResponse }; - } catch (error) { - if (error.status !== 409) - throw error; + } catch (error2) { + if (error2.status !== 409) + throw error2; url = ""; return { value: { @@ -27474,7 +27474,7 @@ var require_parser = __commonJS({ peg$reportedPos ); } - function error(message) { + function error2(message) { throw peg$buildException(message, null, peg$reportedPos); } function peg$computePosDetails(pos) { @@ -39616,9 +39616,9 @@ function remarkStringify(options) { } // node_modules/bail/index.js -function bail(error) { - if (error) { - throw error; +function bail(error2) { + if (error2) { + throw error2; } } @@ -39650,11 +39650,11 @@ function trough() { throw new TypeError("Expected function as last argument, not " + callback); } next(null, ...values); - function next(error, ...output) { + function next(error2, ...output) { const fn = fns[++middlewareIndex]; let index2 = -1; - if (error) { - callback(error); + if (error2) { + callback(error2); return; } while (++index2 < values.length) { @@ -39691,10 +39691,10 @@ function wrap(middleware, callback) { } try { result = middleware.apply(this, parameters); - } catch (error) { + } catch (error2) { const exception = ( /** @type {Error} */ - error + error2 ); if (fnExpectsCallback && called) { throw exception; @@ -39711,10 +39711,10 @@ function wrap(middleware, callback) { } } } - function done(error, ...output) { + function done(error2, ...output) { if (!called) { called = true; - callback(error, ...output); + callback(error2, ...output); } } function then(value) { @@ -40602,9 +40602,9 @@ var Processor = class _Processor extends CallableInstance { /** @type {unknown} */ self.parse(realFile) ); - self.run(parseTree, realFile, function(error, tree, file2) { - if (error || !tree || !file2) { - return realDone(error); + self.run(parseTree, realFile, function(error2, tree, file2) { + if (error2 || !tree || !file2) { + return realDone(error2); } const compileTree = ( /** @type {CompileTree extends undefined ? Node : CompileTree} */ @@ -40618,14 +40618,14 @@ var Processor = class _Processor extends CallableInstance { file2.result = compileResult; } realDone( - error, + error2, /** @type {VFileWithOutput} */ file2 ); }); - function realDone(error, file2) { - if (error || !file2) { - reject(error); + function realDone(error2, file2) { + if (error2 || !file2) { + reject(error2); } else if (resolve) { resolve(file2); } else { @@ -40676,9 +40676,9 @@ var Processor = class _Processor extends CallableInstance { assertDone("processSync", "process", complete); ok2(result, "we either bailed on an error or have a tree"); return result; - function realDone(error, file2) { + function realDone(error2, file2) { complete = true; - bail(error); + bail(error2); result = file2; } } @@ -40736,13 +40736,13 @@ var Processor = class _Processor extends CallableInstance { ); const realFile = vfile(file); transformers.run(tree, realFile, realDone); - function realDone(error, outputTree, file2) { + function realDone(error2, outputTree, file2) { const resultingTree = ( /** @type {TailTree extends undefined ? Node : TailTree} */ outputTree || tree ); - if (error) { - reject(error); + if (error2) { + reject(error2); } else if (resolve) { resolve(resultingTree); } else { @@ -40776,8 +40776,8 @@ var Processor = class _Processor extends CallableInstance { assertDone("runSync", "run", complete); ok2(result, "we either bailed on an error or have a tree"); return result; - function realDone(error, tree2) { - bail(error); + function realDone(error2, tree2) { + bail(error2); result = tree2; complete = true; } @@ -43279,12 +43279,13 @@ async function main({ return; } const jobs = []; + const failedJobs = []; stackGraph.forEachNode((_, stackNode) => { if (stackNode.type !== "pull-request" || !stackNode.shouldPrint) { return; } jobs.push(async () => { - core.info(`Updating stack details for PR #${stackNode.number}`); + core.startGroup(`PR #${stackNode.number}`); const stackGraph2 = getStackGraph(stackNode, repoGraph); const output = getOutput(stackGraph2, terminatingRefs); let description = stackNode.body ?? ""; @@ -43292,14 +43293,33 @@ async function main({ description, output }); - await octokit.rest.pulls.update({ - ...github.context.repo, - pull_number: stackNode.number, - body: description - }); + try { + core.info("Updating PR..."); + const response = await octokit.rest.pulls.update({ + ...github.context.repo, + pull_number: stackNode.number, + body: description + }); + core.info("Done"); + for (const line of (response.data.body ?? "").split("\n")) { + core.info(line); + } + } catch (error2) { + failedJobs.push(stackNode.number); + if (error2 instanceof Error) { + core.error(`Unable to update PR: ${error2.message}`); + } + } finally { + core.endGroup(); + } }); }); await Promise.allSettled(jobs.map((job) => job())); + if (failedJobs.length > 0) { + core.setFailed( + `Action failed for ${failedJobs.map((pullRequestNumber) => `#${pullRequestNumber}`).join(", ")}` + ); + } } function getStackGraph(pullRequest, repoGraph) { const stackGraph = repoGraph.copy(); @@ -43736,8 +43756,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") { @@ -43794,8 +43814,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; @@ -44033,8 +44053,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; } }; @@ -46450,7 +46470,7 @@ var ZodFunction = class _ZodFunction extends ZodType { }); return INVALID; } - function makeArgsIssue(args, error) { + function makeArgsIssue(args, error2) { return makeIssue({ data: args, path: ctx.path, @@ -46462,11 +46482,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, @@ -46478,7 +46498,7 @@ var ZodFunction = class _ZodFunction extends ZodType { ].filter((x) => !!x), issueData: { code: ZodIssueCode.invalid_return_type, - returnTypeError: error + returnTypeError: error2 } }); } @@ -46487,15 +46507,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; }); @@ -47395,9 +47415,9 @@ var inputs = { core2.info(JSON.stringify(pullRequest)); core2.endGroup(); return pullRequest; - } catch (error) { + } catch (error2) { core2.setFailed(`Unable to determine current pull request from action payload`); - throw error; + throw error2; } }, async getPullRequests(octokit, context3, historyLimit) { @@ -47509,11 +47529,11 @@ async function run() { skipSingleStacks: inputs.getSkipSingleStacks() }; void main(context3); - } catch (error) { - if (error instanceof Error) { - core4.setFailed(error.message); + } catch (error2) { + if (error2 instanceof Error) { + core4.setFailed(error2.message); } - throw error; + throw error2; } } /*! Bundled license information: diff --git a/src/main.ts b/src/main.ts index 4022cc4..d119e3a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -93,6 +93,7 @@ export async function main({ } const jobs: Array<() => Promise> = [] + const failedJobs: number[] = [] stackGraph.forEachNode((_, stackNode) => { if (stackNode.type !== 'pull-request' || !stackNode.shouldPrint) { @@ -100,7 +101,7 @@ export async function main({ } jobs.push(async () => { - core.info(`Updating stack details for PR #${stackNode.number}`) + core.startGroup(`PR #${stackNode.number}`) const stackGraph = getStackGraph(stackNode, repoGraph) const output = getOutput(stackGraph, terminatingRefs) @@ -111,15 +112,36 @@ export async function main({ output, }) - await octokit.rest.pulls.update({ - ...github.context.repo, - pull_number: stackNode.number, - body: description, - }) + try { + core.info('Updating PR...') + const response = await octokit.rest.pulls.update({ + ...github.context.repo, + pull_number: stackNode.number, + body: description, + }) + core.info('Done') + for (const line of (response.data.body ?? '').split('\n')) { + core.info(line) + } + } catch (error) { + failedJobs.push(stackNode.number) + + if (error instanceof Error) { + core.error(`Unable to update PR: ${error.message}`) + } + } finally { + core.endGroup() + } }) }) await Promise.allSettled(jobs.map((job) => job())) + + if (failedJobs.length > 0) { + core.setFailed( + `Action failed for ${failedJobs.map((pullRequestNumber) => `#${pullRequestNumber}`).join(', ')}` + ) + } } export function getStackGraph( From 395e8b483590219f311eaccee295bfe0e71f16c0 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Fri, 6 Jun 2025 17:32:37 +1000 Subject: [PATCH 2/5] tweak logging --- dist/index.js | 5 +++-- src/main.ts | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index b9c7ba3..3ed526c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -43300,8 +43300,9 @@ async function main({ pull_number: stackNode.number, body: description }); - core.info("Done"); - for (const line of (response.data.body ?? "").split("\n")) { + core.info("Updated Body:\n"); + const updatedBody = response.data.body ?? ""; + for (const line of updatedBody.split("\n")) { core.info(line); } } catch (error2) { diff --git a/src/main.ts b/src/main.ts index d119e3a..3b9913f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -119,8 +119,10 @@ export async function main({ pull_number: stackNode.number, body: description, }) - core.info('Done') - for (const line of (response.data.body ?? '').split('\n')) { + + core.info('Updated Body:\n') + const updatedBody = response.data.body ?? '' + for (const line of updatedBody.split('\n')) { core.info(line) } } catch (error) { From 60bef3a68f0bd009858ae716ac3618a6d55050ee Mon Sep 17 00:00:00 2001 From: Long Tran Date: Fri, 6 Jun 2025 17:40:56 +1000 Subject: [PATCH 3/5] more logging tweaks --- dist/index.js | 14 ++++++++++---- src/main.ts | 16 ++++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 3ed526c..886ab2e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -43288,11 +43288,17 @@ async function main({ core.startGroup(`PR #${stackNode.number}`); const stackGraph2 = getStackGraph(stackNode, repoGraph); const output = getOutput(stackGraph2, terminatingRefs); + core.info("Output:"); + core.info(""); + output.split("\n").forEach(core.info); let description = stackNode.body ?? ""; description = updateDescription({ description, output }); + core.info("Updated PR description:"); + core.info(""); + description.split("\n").forEach(core.info); try { core.info("Updating PR..."); const response = await octokit.rest.pulls.update({ @@ -43300,11 +43306,11 @@ async function main({ pull_number: stackNode.number, body: description }); - core.info("Updated Body:\n"); + core.info("Done"); + core.info("API response:"); + core.info(""); const updatedBody = response.data.body ?? ""; - for (const line of updatedBody.split("\n")) { - core.info(line); - } + updatedBody.split("\n").forEach(core.info); } catch (error2) { failedJobs.push(stackNode.number); if (error2 instanceof Error) { diff --git a/src/main.ts b/src/main.ts index 3b9913f..40e2353 100644 --- a/src/main.ts +++ b/src/main.ts @@ -106,12 +106,20 @@ export async function main({ const stackGraph = getStackGraph(stackNode, repoGraph) const output = getOutput(stackGraph, terminatingRefs) + core.info('Output:') + core.info('') + output.split('\n').forEach(core.info) + let description = stackNode.body ?? '' description = updateDescription({ description, output, }) + core.info('Updated PR description:') + core.info('') + description.split('\n').forEach(core.info) + try { core.info('Updating PR...') const response = await octokit.rest.pulls.update({ @@ -119,12 +127,12 @@ export async function main({ pull_number: stackNode.number, body: description, }) + core.info('Done') - core.info('Updated Body:\n') + core.info('API response:') + core.info('') const updatedBody = response.data.body ?? '' - for (const line of updatedBody.split('\n')) { - core.info(line) - } + updatedBody.split('\n').forEach(core.info) } catch (error) { failedJobs.push(stackNode.number) From 5e1f2cc989f12b658710e1e3c02c4611a9d7658e Mon Sep 17 00:00:00 2001 From: Long Tran Date: Fri, 6 Jun 2025 17:48:34 +1000 Subject: [PATCH 4/5] more tweaks --- dist/index.js | 11 ++++++----- src/main.ts | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index 886ab2e..9e9f86c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -43288,7 +43288,7 @@ async function main({ core.startGroup(`PR #${stackNode.number}`); const stackGraph2 = getStackGraph(stackNode, repoGraph); const output = getOutput(stackGraph2, terminatingRefs); - core.info("Output:"); + core.info("--- Output ---"); core.info(""); output.split("\n").forEach(core.info); let description = stackNode.body ?? ""; @@ -43296,18 +43296,19 @@ async function main({ description, output }); - core.info("Updated PR description:"); + core.info("--- Updated description ---"); core.info(""); description.split("\n").forEach(core.info); try { - core.info("Updating PR..."); + core.info("Updating PR via GitHub API..."); const response = await octokit.rest.pulls.update({ ...github.context.repo, pull_number: stackNode.number, body: description }); - core.info("Done"); - core.info("API response:"); + core.info("\u2705 Done"); + core.info(""); + core.info("--- API response ---"); core.info(""); const updatedBody = response.data.body ?? ""; updatedBody.split("\n").forEach(core.info); diff --git a/src/main.ts b/src/main.ts index 40e2353..4d6e407 100644 --- a/src/main.ts +++ b/src/main.ts @@ -106,7 +106,7 @@ export async function main({ const stackGraph = getStackGraph(stackNode, repoGraph) const output = getOutput(stackGraph, terminatingRefs) - core.info('Output:') + core.info('--- Output ---') core.info('') output.split('\n').forEach(core.info) @@ -116,20 +116,21 @@ export async function main({ output, }) - core.info('Updated PR description:') + core.info('--- Updated description ---') core.info('') description.split('\n').forEach(core.info) try { - core.info('Updating PR...') + core.info('Updating PR via GitHub API...') const response = await octokit.rest.pulls.update({ ...github.context.repo, pull_number: stackNode.number, body: description, }) - core.info('Done') + core.info('✅ Done') + core.info('') - core.info('API response:') + core.info('--- API response ---') core.info('') const updatedBody = response.data.body ?? '' updatedBody.split('\n').forEach(core.info) From 82118f50bdbe0d49aa7de6fca3019a3ac676ffbf Mon Sep 17 00:00:00 2001 From: Long Tran Date: Fri, 6 Jun 2025 18:07:38 +1000 Subject: [PATCH 5/5] more tweaks --- dist/index.js | 8 ++++++++ src/main.ts | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/dist/index.js b/dist/index.js index 9e9f86c..3adccd5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -43291,6 +43291,9 @@ async function main({ core.info("--- Output ---"); core.info(""); output.split("\n").forEach(core.info); + core.info(""); + core.info("--- End output ---"); + core.info(""); let description = stackNode.body ?? ""; description = updateDescription({ description, @@ -43299,6 +43302,9 @@ async function main({ core.info("--- Updated description ---"); core.info(""); description.split("\n").forEach(core.info); + core.info(""); + core.info("--- End updated description ---"); + core.info(""); try { core.info("Updating PR via GitHub API..."); const response = await octokit.rest.pulls.update({ @@ -43312,6 +43318,8 @@ async function main({ core.info(""); const updatedBody = response.data.body ?? ""; updatedBody.split("\n").forEach(core.info); + core.info(""); + core.info("--- End API response ---"); } catch (error2) { failedJobs.push(stackNode.number); if (error2 instanceof Error) { diff --git a/src/main.ts b/src/main.ts index 4d6e407..c18626e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -109,6 +109,9 @@ export async function main({ core.info('--- Output ---') core.info('') output.split('\n').forEach(core.info) + core.info('') + core.info('--- End output ---') + core.info('') let description = stackNode.body ?? '' description = updateDescription({ @@ -119,6 +122,9 @@ export async function main({ core.info('--- Updated description ---') core.info('') description.split('\n').forEach(core.info) + core.info('') + core.info('--- End updated description ---') + core.info('') try { core.info('Updating PR via GitHub API...') @@ -134,6 +140,8 @@ export async function main({ core.info('') const updatedBody = response.data.body ?? '' updatedBody.split('\n').forEach(core.info) + core.info('') + core.info('--- End API response ---') } catch (error) { failedJobs.push(stackNode.number)