Skip to content

Commit 1390413

Browse files
authored
fix: failing CI for regression benchmark (#1490)
1 parent f41d964 commit 1390413

2 files changed

Lines changed: 45 additions & 14 deletions

File tree

.github/scripts/resolve-regression-trigger.cjs

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,29 @@ module.exports = async ({ github, context, core }) => {
4848
return false;
4949
}
5050

51+
// Cosmetic side effects (reactions, status comments) must never fail the job:
52+
// the gating decision (`should_run`) is the only thing that matters. Run them
53+
// through this wrapper so any API rejection — insufficient token permissions,
54+
// rate limits, transient 5xx — degrades to a warning instead of aborting.
55+
async function bestEffort(description, fn) {
56+
try {
57+
await fn();
58+
} catch (e) {
59+
const message = e instanceof Error ? e.message : String(e);
60+
core.warning(`${description} failed (ignored): ${message}`);
61+
}
62+
}
63+
5164
async function postComment(body) {
5265
if (eventName !== "issue_comment") return;
53-
await github.rest.issues.createComment({
54-
owner,
55-
repo,
56-
issue_number: context.payload.issue.number,
57-
body,
58-
});
66+
await bestEffort("Posting status comment", () =>
67+
github.rest.issues.createComment({
68+
owner,
69+
repo,
70+
issue_number: context.payload.issue.number,
71+
body,
72+
})
73+
);
5974
}
6075

6176
if (eventName === "push") {
@@ -74,16 +89,14 @@ module.exports = async ({ github, context, core }) => {
7489
const allowed = ["OWNER", "MEMBER", "COLLABORATOR"];
7590

7691
// Acknowledge the request.
77-
try {
78-
await github.rest.reactions.createForIssueComment({
92+
await bestEffort("Adding reaction", () =>
93+
github.rest.reactions.createForIssueComment({
7994
owner,
8095
repo,
8196
comment_id: comment.id,
8297
content: "eyes",
83-
});
84-
} catch (e) {
85-
core.warning(`Could not add reaction: ${e.message}`);
86-
}
98+
})
99+
);
87100

88101
if (!allowed.includes(assoc)) {
89102
core.warning(

.github/workflows/hh3-regression-benchmark.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ on:
2525
types: [created]
2626

2727
concurrency:
28-
group: ${{ github.workflow }}-${{ github.event.issue.number || github.ref }}
28+
# Group by PR (comment events) or ref (push/dispatch) so re-triggering `/bench`
29+
# on a PR supersedes the previous run.
30+
#
31+
# Every comment triggers a workflow run. The job-level `if` skips non-`/bench`
32+
# ones, but that runs after concurrency is evaluated, so an unrelated comment
33+
# can cancel an in-progress benchmark. Give those skipped runs a unique group
34+
# so they collide with nothing.
35+
group: ${{ github.workflow }}-${{ github.event.issue.number || github.ref }}${{ (github.event_name == 'issue_comment' && !startsWith(github.event.comment.body, '/bench')) && format('-skip-{0}', github.run_id) || '' }}
2936
# Don't cancel in-progress baseline runs on main so baselines aren't lost.
3037
cancel-in-progress: ${{ github.event_name != 'push' }}
3138

@@ -36,7 +43,7 @@ jobs:
3643
timeout-minutes: 40
3744
permissions:
3845
contents: read # read PR head / checkout metadata
39-
pull-requests: read # pulls.get to resolve PR head + fork check
46+
pull-requests: write # pulls.get + post status comments/reactions on the PR
4047
issues: write # post status comments + reactions on the PR
4148
actions: read # list EDR CI workflow runs for the CI-green gate
4249
# For comment events, only proceed for `/bench` comments on a PR. Other
@@ -158,6 +165,14 @@ jobs:
158165
159166
- name: Start Verdaccio
160167
working-directory: hardhat
168+
# The preceding repoint desyncs packages/hardhat/package.json from
169+
# pnpm-lock.yaml (the `-local.<sha>` sentinel only exists in Verdaccio,
170+
# published later), so disable pnpm's pre-run frozen-lockfile deps check
171+
# for this `pnpm <bin>` invocation — it would otherwise abort with
172+
# ERR_PNPM_OUTDATED_LOCKFILE. Scoped to this step so the earlier
173+
# `pnpm build`/`rebuild` steps keep their verification.
174+
env:
175+
PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN: "false"
161176
run: pnpm verdaccio start --background
162177

163178
- name: Publish local EDR to Verdaccio
@@ -172,6 +187,9 @@ jobs:
172187
working-directory: hardhat
173188
env:
174189
ALCHEMY_URL: ${{ secrets.ALCHEMY_URL }}
190+
# See "Start Verdaccio": bypass pnpm's frozen-lockfile deps check for
191+
# the repoint-desynced workspace.
192+
PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN: "false"
175193
# --force-publish: reuse our already-running Verdaccio (instead of
176194
# erroring) and run the global sinceReleasePublish once up front.
177195
# --use-local: republish the (repointed) hardhat workspace packages and

0 commit comments

Comments
 (0)