Merge branch 'master' into issue-467

This commit is contained in:
Toshiya Doi 2020-02-26 15:37:32 +09:00
commit 8b31b283f5
11 changed files with 465 additions and 82 deletions

View file

@ -40,6 +40,7 @@ type PullRequest struct {
}
}
IsCrossRepository bool
IsDraft bool
MaintainerCanModify bool
ReviewDecision string
@ -157,6 +158,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
login
}
isCrossRepository
isDraft
commits(last: 1) {
nodes {
commit {
@ -367,6 +369,7 @@ func PullRequestForBranch(client *Client, repo ghrepo.Interface, branch string)
login
}
isCrossRepository
isDraft
}
}
}
@ -461,6 +464,7 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) ([]
login
}
isCrossRepository
isDraft
}
`
@ -498,7 +502,7 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) ([]
}
}`
prs := []PullRequest{}
var prs []PullRequest
pageLimit := min(limit, 100)
variables := map[string]interface{}{}
@ -556,7 +560,7 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) ([]
variables[name] = val
}
}
loop:
for {
variables["limit"] = pageLimit
var data response
@ -572,17 +576,16 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) ([]
for _, edge := range prData.Edges {
prs = append(prs, edge.Node)
if len(prs) == limit {
goto done
break loop
}
}
if prData.PageInfo.HasNextPage {
variables["endCursor"] = prData.PageInfo.EndCursor
pageLimit = min(pageLimit, limit-len(prs))
continue
} else {
break
}
done:
break
}
return prs, nil