Skip to content

Commit 4192b66

Browse files
committed
fix(ci): keep failed Bugbot requests eligible for retry
1 parent d032b56 commit 4192b66

3 files changed

Lines changed: 42 additions & 40 deletions

File tree

‎.github/scripts/pr-vouch.test.cjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test("does not trigger Bugbot for closed or draft PRs", () => {
3434
assert.equal(getBugbotDecision({ ...eligible, draft: true }).trigger, false);
3535
});
3636

37-
test("only triggers newly trusted PRs during a bulk vouch sync", () => {
37+
test("keeps a newly trusted bulk PR eligible until its label is synced", () => {
3838
assert.equal(
3939
getBugbotDecision({ ...eligible, eventName: "push", wasTrusted: false }).trigger,
4040
true,

‎.github/workflows/pr-vouch.yml‎

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -216,36 +216,6 @@ jobs:
216216
});
217217
const wasTrusted = currentLabels.some((label) => label.name === "vouch:trusted");
218218
219-
for (const label of currentLabels) {
220-
if (!managedLabelNames.has(label.name) || label.name === nextLabelName) {
221-
continue;
222-
}
223-
224-
try {
225-
await github.rest.issues.removeLabel({
226-
owner: context.repo.owner,
227-
repo: context.repo.repo,
228-
issue_number: issueNumber,
229-
name: label.name,
230-
});
231-
} catch (removeError) {
232-
if (removeError.status !== 404) {
233-
throw removeError;
234-
}
235-
}
236-
}
237-
238-
if (!currentLabels.some((label) => label.name === nextLabelName)) {
239-
await github.rest.issues.addLabels({
240-
owner: context.repo.owner,
241-
repo: context.repo.repo,
242-
issue_number: issueNumber,
243-
labels: [nextLabelName],
244-
});
245-
}
246-
247-
core.info(`PR #${issueNumber}: ${status} -> ${nextLabelName}`);
248-
249219
const { data: pull } = await github.rest.pulls.get({
250220
owner: context.repo.owner,
251221
repo: context.repo.repo,
@@ -276,13 +246,44 @@ jobs:
276246
277247
if (!decision.trigger) {
278248
core.info(`PR #${issueNumber}: skipped Bugbot because ${decision.reason}`);
279-
return;
249+
} else {
250+
const { data: comment } = await github.rest.issues.createComment({
251+
owner: context.repo.owner,
252+
repo: context.repo.repo,
253+
issue_number: issueNumber,
254+
body: renderBugbotRequest(pull.head.sha),
255+
});
256+
core.info(`PR #${issueNumber}: requested Bugbot at ${comment.html_url}`);
280257
}
281258
282-
const { data: comment } = await github.rest.issues.createComment({
283-
owner: context.repo.owner,
284-
repo: context.repo.repo,
285-
issue_number: issueNumber,
286-
body: renderBugbotRequest(pull.head.sha),
287-
});
288-
core.info(`PR #${issueNumber}: requested Bugbot at ${comment.html_url}`);
259+
// Keep the old trust label until a required Bugbot request is recorded.
260+
// A later bulk Vouch sync can then retry if comment creation fails.
261+
for (const label of currentLabels) {
262+
if (!managedLabelNames.has(label.name) || label.name === nextLabelName) {
263+
continue;
264+
}
265+
266+
try {
267+
await github.rest.issues.removeLabel({
268+
owner: context.repo.owner,
269+
repo: context.repo.repo,
270+
issue_number: issueNumber,
271+
name: label.name,
272+
});
273+
} catch (removeError) {
274+
if (removeError.status !== 404) {
275+
throw removeError;
276+
}
277+
}
278+
}
279+
280+
if (!currentLabels.some((label) => label.name === nextLabelName)) {
281+
await github.rest.issues.addLabels({
282+
owner: context.repo.owner,
283+
repo: context.repo.repo,
284+
issue_number: issueNumber,
285+
labels: [nextLabelName],
286+
});
287+
}
288+
289+
core.info(`PR #${issueNumber}: ${status} -> ${nextLabelName}`);

‎docs/internals/ci.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ workflow.
4040
A change to `.github/VOUCHED.td` rechecks every open PR. This bulk check requests Bugbot only for a
4141
PR that changes to `vouch:trusted`. Existing trusted PRs wait for their next commit. Maintainers can
4242
also run the workflow for one PR with the `pr_number` workflow input. Manual runs still apply the
43-
same Vouch check.
43+
same Vouch check. For a newly trusted PR, the workflow records the Bugbot request before it updates
44+
the trust label. If the request fails, the next bulk check can retry it.
4445

4546
Before this workflow reaches `main`, set Cursor Bugbot to **Run only when mentioned** for this
4647
repository. The API equivalent is `manualTriggerOnly: true`. If automatic reviews stay enabled,

0 commit comments

Comments
 (0)