Unverified Commit 7a74549a authored by Michael Daniels's avatar Michael Daniels
Browse files

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.
parent 948fb41b
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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