Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't request reviewers if there are existing reviews #127

Merged
merged 6 commits into from
Oct 15, 2019

Conversation

asvoboda
Copy link
Member

Github removes the set of users requested for review once they finish adding a review, which can cause the HasReviewers() flow to feel pretty klunky.

To fix this, we can also check if there are any reviews left on the PR, and reasonably assume that if a user has already left some reviews that the bot can safely move on.

@@ -277,7 +277,7 @@ func (ghc *GitHubContext) RepositoryCollaborators() (map[string]string, error) {
return ghc.collaborators, nil
}

func (ghc *GitHubContext) HasReveiwers() (bool, error) {
func (ghc *GitHubContext) HasReviewers() (bool, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also fixed a type while I was here

server/handler/base.go Outdated Show resolved Hide resolved
Copy link
Member

@bluekeyes bluekeyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more robust fix might be to only take action if the pull_request event is opened or ready_for_review and otherwise process the event without taking action. That should further help to avoid race conditions between server instances if there are multiple events in quick succession (say pushing and editing, or the auto-edit from something like Reviewable.)

pull/github.go Outdated Show resolved Hide resolved
server/handler/base.go Outdated Show resolved Hide resolved
pull/context.go Outdated Show resolved Hide resolved
@asvoboda asvoboda merged commit 5d53002 into develop Oct 15, 2019
@asvoboda asvoboda deleted the as/check-reviews branch October 15, 2019 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants