Allow pr list filtering of assignee + state

This commit is contained in:
Mislav Marohnić 2019-11-27 18:25:01 +01:00
parent 1bf28927f0
commit aeb060e012

View file

@ -466,8 +466,20 @@ func PullRequestList(client *Client, vars map[string]interface{}, limit int) ([]
owner := vars["owner"].(string)
repo := vars["repo"].(string)
assignee := vars["assignee"].(string)
// TODO: support state, base, label filtering
variables["q"] = fmt.Sprintf("repo:%s/%s assignee:%s is:pr is:open sort:created-desc", owner, repo, assignee)
state := ""
states := vars["state"].([]string)
if len(states) == 1 {
switch states[0] {
case "OPEN":
state = " state:open"
case "CLOSED":
state = " state:closed"
case "MERGED":
state = " is:merged"
}
}
// TODO: support base, label filtering
variables["q"] = fmt.Sprintf("repo:%s/%s assignee:%s is:pr%s sort:created-desc", owner, repo, assignee, state)
}
for {