mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-06-03 04:47:29 +08:00
Accept dismissed approvals as valid reviews
"Dismiss stale reviews on new commits" changes APPROVED → DISMISSED when commits are pushed after approval. The review still happened, so count DISMISSED as a valid approval. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1cbb4c880d
commit
d1c1e52260
17
.github/workflows/detect-unreviewed-merge.yml
vendored
17
.github/workflows/detect-unreviewed-merge.yml
vendored
@ -41,24 +41,17 @@ jobs:
|
|||||||
|
|
||||||
core.info(`Found PR #${pr.number}: ${pr.title}`);
|
core.info(`Found PR #${pr.number}: ${pr.title}`);
|
||||||
|
|
||||||
// Determine effective approval state using latest review per reviewer
|
// Check for approvals. DISMISSED counts because "dismiss stale reviews
|
||||||
|
// on new commits" changes APPROVED → DISMISSED when commits are pushed
|
||||||
|
// after approval — the review still happened.
|
||||||
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 latestByReviewer = new Map();
|
const hasApproval = reviews.some(
|
||||||
for (const r of reviews) {
|
r => r.state === 'APPROVED' || r.state === 'DISMISSED'
|
||||||
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