Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {compare} from "./compare.ts";
import {CLIOptions, benchmarkOptions, fileCollectionOptions, storageOptions} from "./options.ts";
import {run} from "./run.ts";

void yargs(hideBin(process.argv))
yargs(hideBin(process.argv))
.env("BENCHMARK")
.scriptName("benchmark")
.command({
Expand Down Expand Up @@ -83,4 +83,7 @@ void yargs(hideBin(process.argv))
console.error(` ✖ ${errorMessage}\n`);
process.exit(1);
})
.parse();
.parseAsync()
.catch(() => {
// Error already handled by .fail() handler
});
16 changes: 11 additions & 5 deletions src/cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,17 @@ export async function run(opts_: FileCollectionOptions & StorageOptions & Benchm

debug("detecting to post comment. skipPostComment: %o, isGaRun: %o", !opts.skipPostComment, isGaRun());
if (!opts.skipPostComment && isGaRun()) {
await postGaComment({
commentBody: performanceReportComment(resultsComp),
tag: GithubCommentTagEnum.PerformanceReport,
commentOnPush: resultsComp.someFailed,
});
try {
await postGaComment({
commentBody: performanceReportComment(resultsComp),
tag: GithubCommentTagEnum.PerformanceReport,
commentOnPush: resultsComp.someFailed,
});
} catch (e) {
// Don't fail the benchmark run due to comment posting errors
// (e.g. fork PRs lack pull-requests:write permission)
consoleLog(`Warning: Failed to post GitHub comment: ${(e as Error).message}`);
}
}

if (resultsComp.someFailed && !opts.noThrow) {
Expand Down
Loading