Improve maintainer handling

This commit is contained in:
Zero King
2017-07-22 13:37:22 +00:00
parent 1dc08f58a7
commit 37f48e61fb
3 changed files with 37 additions and 23 deletions

View File

@@ -26,19 +26,19 @@ func NewClient(botSecret string) *Client {
}
}
func (client *Client) ListChangedPorts(number int) ([]string, error) {
func (client *Client) ListChangedPortsAndLines(number int) (ports []string, changes []int, err error) {
files, _, err := client.PullRequests.ListFiles(context.Background(), "macports-staging", "macports-ports", number, nil)
if err != nil {
return nil, err
return nil, nil, err
}
ports := make([]string, 0, 1)
portfileRegexp := regexp.MustCompile(`[^\._/][^/]*/([^/]+)/Portfile`)
for _, file := range files {
if match := portfileRegexp.FindStringSubmatch(*file.Filename); match != nil {
ports = append(ports, match[1])
changes = append(changes, *file.Changes)
}
}
return ports, nil
return
}
func (client *Client) CreateComment(owner, repo string, number int, body *string) error {