From fddd1b8a5c640eeef5c4b3e95cfb7dd6d465da10 Mon Sep 17 00:00:00 2001 From: Chris Trzesniewski Date: Thu, 28 Mar 2024 08:32:17 +0100 Subject: [PATCH] add README --- CHANGELOG.md | 1 + src/write.ts | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6b3225c5..f503963f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Unreleased - **fix** Rust benchmarks not comparing to baseline (#235) +- **feat** Comment on PR and auto update comment (#223) # [v1.19.3](https://github.com/benchmark-action/github-action-benchmark/releases/tag/v1.19.3) - 02 Feb 2024 diff --git a/src/write.ts b/src/write.ts index 133d0bc58..27e13798e 100644 --- a/src/write.ts +++ b/src/write.ts @@ -285,14 +285,13 @@ async function handleAlert(benchName: string, curSuite: Benchmark, prevSuite: Be core.debug(`Found ${alerts.length} alerts`); const body = buildAlertComment(alerts, benchName, curSuite, prevSuite, alertThreshold, alertCommentCcUsers); let message = body; - let url = null; if (commentOnAlert) { if (!githubToken) { throw new Error("'comment-on-alert' input is set but 'github-token' input is not set"); } const res = await leaveComment(curSuite.commit.id, body, `${benchName} Alert`, githubToken); - url = res.data.html_url; + const url = res.data.html_url; message = body + `\nComment was generated at ${url}`; } @@ -357,7 +356,7 @@ function addBenchmarkToDataJson( return prevBench; } -function isRemoteRejectedError(err: unknown) { +function isRemoteRejectedError(err: unknown): err is Error { if (err instanceof Error) { return ['[remote rejected]', '[rejected]'].some((l) => err.message.includes(l)); } @@ -436,7 +435,7 @@ async function writeBenchmarkToGitHubPagesWithRetry( console.log( `Automatically pushed the generated commit to ${ghPagesBranch} branch since 'auto-push' is set to true`, ); - } catch (err: any) { + } catch (err: unknown) { if (!isRemoteRejectedError(err)) { throw err; }