Add pull command
This commit is contained in:
parent
7829bbca13
commit
2f6d27d831
5 changed files with 76 additions and 3 deletions
|
@ -87,9 +87,6 @@ func (a *App) PublishNextInGithub(dryRun bool) (bool, error) {
|
|||
}
|
||||
|
||||
ticket.GithubLink = issue.GetNumber()
|
||||
if user := issue.GetUser(); user != nil {
|
||||
ticket.GithubAssignee = user.GetLogin()
|
||||
}
|
||||
ticket.GithubStatus = issue.GetState()
|
||||
if err := a.Save(); err != nil {
|
||||
return false, err
|
||||
|
|
34
app/jira.go
34
app/jira.go
|
@ -183,3 +183,37 @@ func (a *App) PublishBatchInJira(batch int, dryRun bool) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) GetTicketsFromJiraEpic() ([]*model.Ticket, error) {
|
||||
jql := fmt.Sprintf("project = %s AND type = %s AND \"Epic Link\" = %s", a.Campaign.Jira.Project, a.Campaign.Jira.IssueType, a.Campaign.Jira.Epic)
|
||||
|
||||
page := 0
|
||||
maxPerPage := 50
|
||||
issues := []jira.Issue{}
|
||||
for {
|
||||
opts := &jira.SearchOptions{StartAt: maxPerPage * page, MaxResults: maxPerPage}
|
||||
pageIssues, _, err := a.JiraClient.Issue.Search(jql, opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
issues = append(issues, pageIssues...)
|
||||
if len(pageIssues) < maxPerPage {
|
||||
break
|
||||
}
|
||||
page++
|
||||
}
|
||||
|
||||
tickets := []*model.Ticket{}
|
||||
for _, issue := range issues {
|
||||
// ToDo: if they have github link, fill and fetch github data
|
||||
ticket := &model.Ticket{
|
||||
JiraLink: issue.Key,
|
||||
JiraStatus: issue.Fields.Status.Name,
|
||||
Summary: issue.Fields.Summary,
|
||||
Description: issue.Fields.Description,
|
||||
}
|
||||
tickets = append(tickets, ticket)
|
||||
}
|
||||
return tickets, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue