mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-09 16:18:34 +01:00
ci/github-script/merge: fix with deleted users
When a deleted user had approved a PR, this will cause the merge-bot to fail.
This commit is contained in:
parent
d7c3dfa577
commit
43f3fcc555
|
|
@ -34,7 +34,9 @@ function runChecklist({
|
||||||
// bad code between the approval and the merge.
|
// bad code between the approval and the merge.
|
||||||
commit_id === pull_request.head.sha,
|
commit_id === pull_request.head.sha,
|
||||||
)
|
)
|
||||||
.map(({ user }) => user.id),
|
.map(({ user }) => user?.id)
|
||||||
|
// Some users have been deleted, so filter these out.
|
||||||
|
.filter(Boolean),
|
||||||
)
|
)
|
||||||
|
|
||||||
const checklist = {
|
const checklist = {
|
||||||
|
|
@ -158,12 +160,14 @@ async function handleMerge({
|
||||||
)
|
)
|
||||||
|
|
||||||
const comments = events.slice(lastPush + 1).filter(
|
const comments = events.slice(lastPush + 1).filter(
|
||||||
({ event, body, node_id }) =>
|
({ event, body, user, node_id }) =>
|
||||||
['commented', 'reviewed'].includes(event) &&
|
['commented', 'reviewed'].includes(event) &&
|
||||||
hasMergeCommand(body) &&
|
hasMergeCommand(body) &&
|
||||||
|
// Ignore comments where the user has been deleted already.
|
||||||
|
user &&
|
||||||
// Ignore comments which had already been responded to by the bot.
|
// Ignore comments which had already been responded to by the bot.
|
||||||
!events.some(
|
!events.some(
|
||||||
({ event, user, body }) =>
|
({ event, body }) =>
|
||||||
['commented'].includes(event) &&
|
['commented'].includes(event) &&
|
||||||
// We're only testing this hidden reference, but not the author of the comment.
|
// We're only testing this hidden reference, but not the author of the comment.
|
||||||
// We'll just assume that nobody creates comments with this marker on purpose.
|
// We'll just assume that nobody creates comments with this marker on purpose.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue