mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-30 19:07:25 +08:00
Revert to latest-per-reviewer approval check for OSS repos
Dismissed approvals should NOT be counted in OSS repos — PRs require current approval at merge time. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d1c1e52260
commit
09403bd734
19
.github/workflows/detect-unreviewed-merge.yml
vendored
19
.github/workflows/detect-unreviewed-merge.yml
vendored
@ -41,17 +41,26 @@ jobs:
|
|||||||
|
|
||||||
core.info(`Found PR #${pr.number}: ${pr.title}`);
|
core.info(`Found PR #${pr.number}: ${pr.title}`);
|
||||||
|
|
||||||
// Check for approvals. DISMISSED counts because "dismiss stale reviews
|
// Check for approving reviews using latest review per reviewer.
|
||||||
// on new commits" changes APPROVED → DISMISSED when commits are pushed
|
// DISMISSED approvals (from "dismiss stale reviews on new commits")
|
||||||
// after approval — the review still happened.
|
// are intentionally NOT counted — OSS PRs require current approval.
|
||||||
const reviews = await github.paginate(github.rest.pulls.listReviews, {
|
const reviews = await github.paginate(github.rest.pulls.listReviews, {
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
pull_number: pr.number,
|
pull_number: pr.number,
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasApproval = reviews.some(
|
const latestByReviewer = new Map();
|
||||||
r => r.state === 'APPROVED' || r.state === 'DISMISSED'
|
for (const r of reviews) {
|
||||||
|
if (!r.user || r.state === 'COMMENTED') continue;
|
||||||
|
const prev = latestByReviewer.get(r.user.login);
|
||||||
|
if (!prev || new Date(r.submitted_at) > new Date(prev.submitted_at)) {
|
||||||
|
latestByReviewer.set(r.user.login, r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasApproval = Array.from(latestByReviewer.values()).some(
|
||||||
|
r => r.state === 'APPROVED'
|
||||||
);
|
);
|
||||||
if (hasApproval) {
|
if (hasApproval) {
|
||||||
core.info('PR has an approving review — no action needed.');
|
core.info('PR has an approving review — no action needed.');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user