Skip to content

Commit 1ab7306

Browse files
committed
Fix maintainer-approval not blocking PRs without approval
The previous change switched maintainer-approval from commit statuses to check runs for better UI visibility. However, check runs with status "in_progress" are treated by GitHub as "still running" rather than "explicitly blocking". This means the required status check was satisfied without any approval. Fix by using status "completed" with conclusion "action_required" for pending approval states. This properly blocks the PR until approval is granted. Co-authored-by: Isaac
1 parent 8bc2b1a commit 1ab7306

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

.github/workflows/maintainer-approval.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,8 @@ module.exports = async ({ github, context, core }) => {
537537
core.info(msg);
538538
await github.rest.checks.create({
539539
...checkParams,
540-
status: "in_progress",
540+
status: "completed",
541+
conclusion: "action_required",
541542
output: { title: STATUS_CONTEXT, summary: msg },
542543
});
543544
} else if (result.uncovered && result.uncovered.length > 0) {
@@ -550,15 +551,17 @@ module.exports = async ({ github, context, core }) => {
550551
);
551552
await github.rest.checks.create({
552553
...checkParams,
553-
status: "in_progress",
554+
status: "completed",
555+
conclusion: "action_required",
554556
output: { title: STATUS_CONTEXT, summary: msg },
555557
});
556558
} else {
557559
const msg = `Waiting for maintainer approval: ${maintainers.join(", ")}`;
558560
core.info(msg);
559561
await github.rest.checks.create({
560562
...checkParams,
561-
status: "in_progress",
563+
status: "completed",
564+
conclusion: "action_required",
562565
output: { title: STATUS_CONTEXT, summary: msg },
563566
});
564567
}

.github/workflows/maintainer-approval.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ describe("maintainer-approval", () => {
252252
await runModule({ github, context, core });
253253

254254
assert.equal(github._checkRuns.length, 1);
255-
assert.equal(github._checkRuns[0].status, "in_progress");
255+
assert.equal(github._checkRuns[0].conclusion, "action_required");
256256
assert.ok(github._checkRuns[0].output.summary.includes("/bundle/"));
257257
});
258258

@@ -269,7 +269,7 @@ describe("maintainer-approval", () => {
269269
await runModule({ github, context, core });
270270

271271
assert.equal(github._checkRuns.length, 1);
272-
assert.equal(github._checkRuns[0].status, "in_progress");
272+
assert.equal(github._checkRuns[0].conclusion, "action_required");
273273
assert.ok(github._checkRuns[0].output.summary.includes("maintainer"));
274274
});
275275

@@ -284,7 +284,7 @@ describe("maintainer-approval", () => {
284284
await runModule({ github, context, core });
285285

286286
assert.equal(github._checkRuns.length, 1);
287-
assert.equal(github._checkRuns[0].status, "in_progress");
287+
assert.equal(github._checkRuns[0].conclusion, "action_required");
288288
});
289289

290290
it("team member approved -> success for team-owned path", async () => {
@@ -318,7 +318,7 @@ describe("maintainer-approval", () => {
318318
await runModule({ github, context, core });
319319

320320
assert.equal(github._checkRuns.length, 1);
321-
assert.equal(github._checkRuns[0].status, "in_progress");
321+
assert.equal(github._checkRuns[0].conclusion, "action_required");
322322
});
323323

324324
it("CHANGES_REQUESTED does not count as approval", async () => {
@@ -334,7 +334,7 @@ describe("maintainer-approval", () => {
334334
await runModule({ github, context, core });
335335

336336
assert.equal(github._checkRuns.length, 1);
337-
assert.equal(github._checkRuns[0].status, "in_progress");
337+
assert.equal(github._checkRuns[0].conclusion, "action_required");
338338
});
339339

340340
it("self-approval by PR author is excluded", async () => {
@@ -350,7 +350,7 @@ describe("maintainer-approval", () => {
350350
await runModule({ github, context, core });
351351

352352
assert.equal(github._checkRuns.length, 1);
353-
assert.equal(github._checkRuns[0].status, "in_progress");
353+
assert.equal(github._checkRuns[0].conclusion, "action_required");
354354
});
355355

356356
it("no * rule in OWNERS -> setFailed", async () => {

0 commit comments

Comments
 (0)