ci/github-script/reviews: rework dismissal/non-posting logic

Dismissals are done automatically by commits.js, even for reviews from
check-target-branches.js. This is not desirable.

The solution is
(1) do not decline to post a review because it was already dismissed
    (because it may have not been dismissed by a human, and circumstances may
    have changed), and
(2) reword the auto-dismissal message to not imply that whatever
    problems were present are fixed.
This commit is contained in:
Michael Daniels
2026-01-17 20:59:12 -05:00
parent 82d83c564c
commit e05e984689

View File

@@ -19,13 +19,13 @@ async function dismissReviews({ github, context, dry }) {
...context.repo,
pull_number,
review_id: review.id,
message: 'All good now, thank you!',
message: 'Review dismissed automatically',
})
}
await github.graphql(
`mutation($node_id:ID!) {
minimizeComment(input: {
classifier: RESOLVED,
classifier: OUTDATED,
subjectId: $node_id
})
{ clientMutationId }
@@ -49,10 +49,7 @@ async function postReview({ github, context, core, dry, body }) {
review.user?.login === 'github-actions[bot]' &&
// If a review is still pending, we can just update this instead
// of posting a new one.
(review.state === 'CHANGES_REQUESTED' ||
// No need to post a new review, if an older one with the exact
// same content had already been dismissed.
review.body === body),
review.state === 'CHANGES_REQUESTED',
)
if (dry) {