Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(ci): recheck contribution eligibility when PRs close

Tin37ce54895415
diff --git a/.github/workflows/contribution-eligibility.yml b/.github/workflows/contribution-eligibility.yml
index 6e5dca29d..2a44b78b2 100644
--- a/.github/workflows/contribution-eligibility.yml
+++ b/.github/workflows/contribution-eligibility.yml
@@ -4,7 +4,7 @@ on:
# zizmor: ignore[dangerous-triggers] Only executes policy code from main;
# never checks out or executes pull-request content.
pull_request_target:
- types: [opened, edited, synchronize, reopened, ready_for_review]
+ types: [opened, edited, synchronize, reopened, ready_for_review, closed]
issues:
types: [labeled, unlabeled, closed, reopened, deleted, transferred]
label:
diff --git a/scripts/contribution-eligibility/check.test.mjs b/scripts/contribution-eligibility/check.test.mjs
index f87aa6f71..cddecfbb0 100644
--- a/scripts/contribution-eligibility/check.test.mjs
+++ b/scripts/contribution-eligibility/check.test.mjs
@@ -279,6 +279,24 @@ test("a vouched PR never overrides an ineligible PR on the same commit", async (
}
});
+test("closing an ineligible PR clears its failure from a shared commit on recheck", async () => {
+ const pulls = [pull, { ...pull, number: 2, user: { ...pull.user, id: 456 } }];
+ const { github, statuses } = fixture({ pulls, links: [] });
+ const vouched = {
+ ...policy,
+ vouchedContributors: [{ id: 123, login: "trusted", reason: "Trusted." }],
+ };
+ await reconcile(github, async () => vouched);
+ assert.equal(statuses.at(-1).state, "failure");
+ assert.match(statuses.at(-1).description, /PR #2/);
+
+ pulls.pop();
+ await reconcile(github, async () => vouched);
+ assert.equal(statuses.at(-1).sha, sha);
+ assert.equal(statuses.at(-1).state, "success");
+ assert.match(statuses.at(-1).description, /PR #1/);
+});
+
test("a failure on one PR still updates other PRs before failing the workflow", async () => {
const { github, statuses } = fixture({
pulls: [pull, { ...pull, number: 2, head: { sha: "b".repeat(40) } }],