Skip to content

x/build/cmd/gopherbot: add has-cl label to issues with CL #9

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

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 14 additions & 0 deletions cmd/gopherbot/gopherbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ func (b *gopherbot) closeStaleWaitingForInfo(ctx context.Context) error {

// cl2issue writes "Change https://golang.org/issue/NNNN mentions this issue"\
// and the change summary on GitHub when a new Gerrit change references a GitHub issue.
// It also labels the issue as "has-cl".
func (b *gopherbot) cl2issue(ctx context.Context) error {
monthAgo := time.Now().Add(-30 * 24 * time.Hour)
return b.corpus.Gerrit().ForeachProjectUnsorted(func(gp *maintner.GerritProject) error {
Expand Down Expand Up @@ -846,6 +847,19 @@ func (b *gopherbot) cl2issue(ctx context.Context) error {
return err
}
}
needsHasCLLabel := !gi.HasLabel("has-cl")
gi.ForeachEvent(func(c *maintner.GitHubIssueEvent) error {
if c.Type == "unlabeled" && c.Label == "has-cl" {
needsHasCLLabel = false
return errStopIteration
}
return nil
})
if needsHasCLLabel {
if err := b.addLabel(ctx, gi, "has-cl"); err != nil {
return err
}
}
}
return nil
})
Expand Down