-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add netlify preview build via github actions.
- Loading branch information
Showing
7 changed files
with
81 additions
and
13 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,58 @@ | ||
// jshint esversion: 6 | ||
|
||
// This code will check that the pull request has been approved via GitHub review approval by a | ||
// minimum number of reviewers and by all assignees, and that no changes were requested by any | ||
// reviewers. Only reviewers with write access to the repository are considered. | ||
// | ||
// This is very similar to GitHub's built-in branch protection option to require pull request | ||
// reviews before merging, but allows for much more flexibility and customization. | ||
|
||
// dependencies: lodash4 | ||
|
||
// The number of approvals required to merge. | ||
let numApprovalsRequired = 1; | ||
|
||
const approvals = review.pullRequest.approvals; | ||
|
||
let numApprovals = _.filter(approvals, (x) => x === 'approved').length; | ||
const numRejections = _.filter(approvals, (x) => x === 'changes_requested').length; | ||
|
||
const discussionBlockers = _(review.discussions) | ||
.filter((x) => !x.resolved) | ||
.flatMap('participants') | ||
.filter((x) => !x.resolved) | ||
.map(user => _.pick(user, 'username')) | ||
.value(); | ||
|
||
let pendingReviewers = _(discussionBlockers) | ||
.map(user => _.pick(user, 'username')) | ||
.concat(review.pullRequest.requestedReviewers) | ||
.value(); | ||
|
||
const required = _.map(review.pullRequest.assignees, 'username'); | ||
_.pull(required, review.pullRequest.author.username); | ||
if (required.length) { | ||
numApprovalsRequired = _.max([required.length, numApprovalsRequired]); | ||
numApprovals = | ||
(_(approvals).pick(required).filter('approved').size()) + | ||
_.min([numApprovals, numApprovalsRequired - required.length]); | ||
pendingReviewers = _(required) | ||
.reject(username => approvals[username] === 'approved') | ||
.reject(username => pendingReviewers.length && approvals[username]) | ||
.map(username => ({username})) | ||
.concat(pendingReviewers) | ||
.value(); | ||
} | ||
|
||
pendingReviewers = _.uniqBy(pendingReviewers, 'username'); | ||
|
||
const description = | ||
(numRejections ? `${numRejections} change requests, ` : '') + | ||
`${numApprovals} of ${numApprovalsRequired} approvals obtained`; | ||
const shortDescription = | ||
(numRejections ? `${numRejections} ✗, ` : '') + `${numApprovals} of ${numApprovalsRequired} ✓`; | ||
|
||
return { | ||
completed: numApprovals >= numApprovalsRequired, | ||
description, shortDescription, pendingReviewers | ||
}; |
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,4 @@ | ||
# Reviewable settings file. Read the docs at https://docs.reviewable.io/repositories.html#store-repository-settings-using-the-reviewable-directory | ||
approval-text: ":lgtm_strong:" | ||
github-status: | ||
updates: always |
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 was deleted.
Oops, something went wrong.