ci/github-script/reviews: detect reviews belonging to commits.js

See comment, but TLDR this is for backwards-compatibility.

(See 479628, where it failed to dismiss after fixing.)

We don't bother with `prepare.js` because it always errors
(and so should never be dismissed).

I have simply added the needed comments to each of `check-target-branch.js`'s
pre-existing reviews, because there are so few.
This commit is contained in:
Michael Daniels 2026-01-26 19:32:33 -05:00
parent 948fb41b76
commit 7a74549a85
No known key found for this signature in database

View file

@ -66,7 +66,13 @@ async function dismissReviews({ github, context, core, dry, reviewKey }) {
changesRequestedReviews.every(
(review) =>
commentResolvedRegex.test(review.body) ||
(reviewKey && reviewKeyRegex.test(review.body)),
(reviewKey && reviewKeyRegex.test(review.body)) ||
// If we are called by check-commits and the review body is clearly
// from `commits.js`, then we can safely dismiss the review.
// This helps with pre-existing reviews (before the comments were added).
(reviewKey &&
reviewKey === 'check-commits' &&
review.body.includes('PR / Check / cherry-pick')),
)
) {
reviewsToDismiss = changesRequestedReviews