forked from angular/dev-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ng-dev): disallow merging if no members of the organization have…
… approved the pull request (angular#1744) This is in large part meant to prevent someone being able to merge a pull request that is unreviewed. PR Close angular#1744
- Loading branch information
1 parent
cef5d14
commit 8e21b74
Showing
6 changed files
with
75 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {PullRequestFromGithub} from '../fetch-pull-request.js'; | ||
import {createPullRequestValidation, PullRequestValidation} from './validation-config.js'; | ||
|
||
/** Assert the pull request has completed all requested reviews. */ | ||
export const minimumReviewsValidation = createPullRequestValidation( | ||
{name: 'assertMinimumReviews', canBeForceIgnored: false}, | ||
() => Validation, | ||
); | ||
|
||
class Validation extends PullRequestValidation { | ||
assert(pullRequest: PullRequestFromGithub) { | ||
const totalCount = pullRequest.reviews.nodes.filter( | ||
({authorAssociation}) => authorAssociation === 'MEMBER', | ||
).length; | ||
if (totalCount === 0) { | ||
throw this._createError( | ||
`Pull request cannot be merged without at least one review from a team member`, | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters