mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-09 16:18:34 +01:00
ci/github-script/bot: disregard bot and ghost approvals
We technically counted bot approvals and approvals by deleted users for the approval labels as well. The former don't exist, yet, but if they were, I don't think we'd count them. The latter should arguably *not* be counted, because we can't tell anymore *who* approved, so we can't put any weight on it as reviewers. This simplifies the logic, too.
This commit is contained in:
parent
61c4403428
commit
df6a9a739d
|
|
@ -209,10 +209,16 @@ module.exports = async ({ github, context, core, dry }) => {
|
|||
}
|
||||
}
|
||||
|
||||
const reviews = await github.paginate(github.rest.pulls.listReviews, {
|
||||
...context.repo,
|
||||
pull_number,
|
||||
})
|
||||
// Check for any human reviews other than GitHub actions and other GitHub apps.
|
||||
// Accounts could be deleted as well, so don't count them.
|
||||
const reviews = (
|
||||
await github.paginate(github.rest.pulls.listReviews, {
|
||||
...context.repo,
|
||||
pull_number,
|
||||
})
|
||||
).filter(
|
||||
(r) => r.user && !r.user.login.endsWith('[bot]') && r.user.type !== 'Bot',
|
||||
)
|
||||
|
||||
const approvals = new Set(
|
||||
reviews
|
||||
|
|
@ -282,13 +288,6 @@ module.exports = async ({ github, context, core, dry }) => {
|
|||
log('Last eval run', run_id ?? '<n/a>')
|
||||
|
||||
if (conclusion === 'success') {
|
||||
// Check for any human reviews other than GitHub actions and other GitHub apps.
|
||||
// Accounts could be deleted as well, so don't count them.
|
||||
const humanReviews = reviews.filter(
|
||||
(r) =>
|
||||
r.user && !r.user.login.endsWith('[bot]') && r.user.type !== 'Bot',
|
||||
)
|
||||
|
||||
Object.assign(prLabels, {
|
||||
// We only set this label if the latest eval run was successful, because if it was not, it
|
||||
// *could* have requested reviewers. We will let the PR author fix CI first, before "escalating"
|
||||
|
|
@ -301,7 +300,7 @@ module.exports = async ({ github, context, core, dry }) => {
|
|||
'9.needs: reviewer':
|
||||
!pull_request.draft &&
|
||||
pull_request.requested_reviewers.length === 0 &&
|
||||
humanReviews.length === 0,
|
||||
reviews.length === 0,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue