ci,workflows: deal with ghost reviews

When a user deletes their account, they appear as a "ghost user". This
user is represented as `null` on API requests. If such a user had posted
a review before, this breaks a few places, which assume to be able to
access `user.login`.

Changed files
+3 -3
.github
ci
github-script
+1 -1
.github/workflows/dismissed-review.yml
···
repo: context.repo.repo,
pull_number: pull_request.number
})).filter(review =>
-
review.user.login == 'github-actions[bot]' &&
review.state == 'DISMISSED'
).map(review => github.graphql(`
mutation($node_id:ID!) {
···
repo: context.repo.repo,
pull_number: pull_request.number
})).filter(review =>
+
review.user?.login == 'github-actions[bot]' &&
review.state == 'DISMISSED'
).map(review => github.graphql(`
mutation($node_id:ID!) {
+2 -2
ci/github-script/reviews.js
···
pull_number,
})
)
-
.filter((review) => review.user.login === 'github-actions[bot]')
.map(async (review) => {
if (review.state === 'CHANGES_REQUESTED') {
await github.rest.pulls.dismissReview({
···
})
).find(
(review) =>
-
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' ||
···
pull_number,
})
)
+
.filter((review) => review.user?.login === 'github-actions[bot]')
.map(async (review) => {
if (review.state === 'CHANGES_REQUESTED') {
await github.rest.pulls.dismissReview({
···
})
).find(
(review) =>
+
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' ||