func bulkEditStart(issues []*github.Issue) (*github.Issue, []byte) { common := new(github.Issue) for i, issue := range issues { if i == 0 { common.State = issue.State common.Assignee = issue.Assignee common.Labels = issue.Labels common.Milestone = issue.Milestone continue } if common.State != nil && getString(common.State) != getString(issue.State) { common.State = nil } if common.Assignee != nil && getUserLogin(common.Assignee) != getUserLogin(issue.Assignee) { common.Assignee = nil } if common.Milestone != nil && getMilestoneTitle(common.Milestone) != getMilestoneTitle(issue.Milestone) { common.Milestone = nil } common.Labels = commonLabels(common.Labels, issue.Labels) } var buf bytes.Buffer fmt.Fprintf(&buf, "State: %s\n", getString(common.State)) fmt.Fprintf(&buf, "Assignee: %s\n", getUserLogin(common.Assignee)) fmt.Fprintf(&buf, "Labels: %s\n", strings.Join(getLabelNames(common.Labels), " ")) fmt.Fprintf(&buf, "Milestone: %s\n", getMilestoneTitle(common.Milestone)) fmt.Fprintf(&buf, "\n<optional comment here>\n") fmt.Fprintf(&buf, "%s\n", bulkHeader) for _, issue := range issues { fmt.Fprintf(&buf, "%d\t%s\n", getInt(issue.Number), getString(issue.Title)) } return common, buf.Bytes() }
func labelIssue(label string, issue *github.Issue) *github.Issue { l := github.Label{ Name: stringPtr(label), } issue.Labels = append(issue.Labels, l) return issue }