@@ -336,3 +336,46 @@ jobs:
336336 "workflow_name": "${{ github.workflow }}",
337337 "run_url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
338338 }
339+
340+ report :
341+ name : Report result to PR
342+ needs : [setup, regression-benchmark]
343+ # 1. run on benchmark failure but skip when the run is superseded (concurrency)
344+ # 2. Only report back to the PR for `/bench` comment triggers
345+ # 3. Only report back if the benchmark actually started
346+ # prettier-ignore
347+ if : >-
348+ !cancelled()
349+ && github.event_name == 'issue_comment'
350+ && needs.setup.outputs.should_run == 'true'
351+ runs-on : ubuntu-latest
352+ permissions :
353+ issues : write # post the result comment on the PR
354+ steps :
355+ - uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
356+ env :
357+ RESULT : ${{ needs.regression-benchmark.result }}
358+ EDR_REF : ${{ needs.setup.outputs.edr_ref }}
359+ HARDHAT_REF : ${{ needs.setup.outputs.hardhat_ref }}
360+ with :
361+ script : |
362+ const { RESULT, EDR_REF, HARDHAT_REF } = process.env;
363+ const runUrl =
364+ `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}` +
365+ `/actions/runs/${context.runId}`;
366+ const target =
367+ `\`${EDR_REF.slice(0, 12)}\` against Hardhat \`${HARDHAT_REF}\``;
368+ const body =
369+ RESULT === "success"
370+ ? `✅ Regression benchmark passed for ${target}.\n\n` +
371+ `[View workflow run](${runUrl})`
372+ : `❌ Regression benchmark failed for ${target}. This is either ` +
373+ `a detected performance regression or an infrastructure ` +
374+ `failure — see the run for details.\n\n` +
375+ `[View workflow run](${runUrl})`;
376+ await github.rest.issues.createComment({
377+ owner: context.repo.owner,
378+ repo: context.repo.repo,
379+ issue_number: context.payload.issue.number,
380+ body,
381+ });
0 commit comments