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

Fix some typos #19521

Merged
merged 1 commit into from
Oct 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions prow/plugins/lgtm/lgtm.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,23 +279,23 @@ func handle(wantLGTM bool, config *plugins.Configuration, ownersClient repoowner
// check if skip collaborators is enabled for this org/repo
skipCollaborators := skipCollaborators(config, org, repoName)

// check if the commentor is a collaborator
// check if the commenter is a collaborator
isCollaborator, err := gc.IsCollaborator(org, repoName, author)
if err != nil {
log.WithError(err).Error("Failed to check if author is a collaborator.")
return err // abort if we can't determine if commentor is a collaborator
return err // abort if we can't determine if commenter is a collaborator
}

// if commentor isn't a collaborator, and we care about collaborators, abort
// if commenter isn't a collaborator, and we care about collaborators, abort
if !isAuthor && !skipCollaborators && !isCollaborator {
resp := "changing LGTM is restricted to collaborators"
log.Infof("Reply to /lgtm request with comment: \"%s\"", resp)
return gc.CreateComment(org, repoName, number, plugins.FormatResponseRaw(body, htmlURL, author, resp))
}

// either ensure that the commentor is a collaborator or an approver/reviewer
// either ensure that the commenter is a collaborator or an approver/reviewer
if !isAuthor && !isAssignee && !skipCollaborators {
// in this case we need to ensure the commentor is assignable to the PR
// in this case we need to ensure the commenter is assignable to the PR
// by assigning them
log.Infof("Assigning %s/%s#%d to %s", org, repoName, number, author)
if err := gc.AssignIssue(org, repoName, number, []string{author}); err != nil {
Expand All @@ -321,7 +321,7 @@ func handle(wantLGTM bool, config *plugins.Configuration, ownersClient repoowner
}

// now we update the LGTM labels, having checked all cases where changing
// LGTM was not allowed for the commentor
// LGTM was not allowed for the commenter

// Only add the label if it doesn't have it, and vice versa.
labels, err := gc.GetIssueLabels(org, repoName, number)
Expand Down Expand Up @@ -429,7 +429,7 @@ func handlePullRequest(log *logrus.Entry, gc githubClient, config *plugins.Confi
if opts.StoreTreeHash {
// Check if we have a tree-hash comment
var lastLgtmTreeHash string
botname, err := gc.BotName()
botName, err := gc.BotName()
if err != nil {
return err
}
Expand All @@ -442,7 +442,7 @@ func handlePullRequest(log *logrus.Entry, gc githubClient, config *plugins.Confi
for i := len(comments) - 1; i >= 0; i-- {
comment := comments[i]
m := addLGTMLabelNotificationRe.FindStringSubmatch(comment.Body)
if comment.User.Login == botname && m != nil && comment.UpdatedAt.Equal(comment.CreatedAt) {
if comment.User.Login == botName && m != nil && comment.UpdatedAt.Equal(comment.CreatedAt) {
lastLgtmTreeHash = m[1]
break
}
Expand Down