From ced0a830b2b3d1438a6b64c70bcdf92aca0009d1 Mon Sep 17 00:00:00 2001 From: William Grzybowski Date: Sun, 13 Sep 2026 13:24:36 -0300 Subject: [PATCH] Fall back from a refused APPROVE only on 422 A timed-out or dropped request may have created the approval; commenting then would dismiss it. Anything but a refusal goes to the outer catch, as before. README no longer counts two COMMENT outcomes. --- README.md | 2 +- review/submit-verdict.mjs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 84f3057..3b6b1b0 100644 --- a/README.md +++ b/README.md @@ -304,7 +304,7 @@ said, and is where a repo puts the paths it always wants eyes on. Each run adds a review; GitHub reviews are appended, not edited, so a PR with ten pushes carries ten of them, and the newest is the one that describes the -head commit. REQUEST_CHANGES and APPROVE change the PR's state; the two +head commit. REQUEST_CHANGES and APPROVE change the PR's state; the COMMENT outcomes do not. Nothing is submitted when the reviewer crashed, on purpose: a changes-requested diff --git a/review/submit-verdict.mjs b/review/submit-verdict.mjs index af3d398..97e805a 100644 --- a/review/submit-verdict.mjs +++ b/review/submit-verdict.mjs @@ -312,6 +312,10 @@ try { 'Nothing blocks and no human review is needed.', ]); } catch (error) { + // Only a refusal falls back. A request that got no answer (the 15s + // timeout, a dropped connection) may have created the review anyway, + // and commenting then would dismiss the approval that landed. + if (!/HTTP 422/.test(error.message)) throw error; console.log(`::warning::could not approve: ${escapeData(error.message)}`); approveHint(error); const own = await submit('COMMENT', [