-
Notifications
You must be signed in to change notification settings - Fork 102
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
Conversation
@@ -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) { |
There was a problem hiding this comment.
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
There was a problem hiding this 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.)
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.