11package github
22
33import (
4- "golang.org/x/oauth2"
5- "golang.org/x/net/context"
6- "github.com/shurcooL/githubql"
7- "github.com/google/go-github/github"
84 "net/http"
5+
6+ "github.com/google/go-github/github"
7+ "github.com/shurcooL/githubql"
8+ "golang.org/x/net/context"
9+ "golang.org/x/oauth2"
910)
1011
1112type githubManager struct {
@@ -14,7 +15,7 @@ type githubManager struct {
1415 HttpClient * http.Client
1516}
1617
17- func New (githubAccessToken string ) ( * githubManager ) {
18+ func New (githubAccessToken string ) * githubManager {
1819 ctx := context .Background ()
1920 src := oauth2 .StaticTokenSource (
2021 & oauth2.Token {AccessToken : githubAccessToken },
@@ -47,7 +48,7 @@ func (gm *githubManager) GetCommits(owner, repo, branch string, lastCommitsNumbe
4748 return hydrateCommits (q ), nil
4849}
4950
50- func PickFirstParentCommits (fullCommitsList []Commit ) ( []Commit ) {
51+ func PickFirstParentCommits (fullCommitsList []Commit ) []Commit {
5152 var firstParentCommits []Commit
5253 if 0 == len (fullCommitsList ) {
5354 return firstParentCommits
@@ -76,7 +77,7 @@ func PickFirstParentCommits(fullCommitsList []Commit) ([]Commit) {
7677}
7778
7879// TODO remove v3 client when implemented in v4
79- func (gm * githubManager ) ChangeBranchHead (owner , repo , branch , sha string , force bool ) ( error ) {
80+ func (gm * githubManager ) ChangeBranchHead (owner , repo , branch , sha string , force bool ) error {
8081 httpClient := gm .HttpClient
8182
8283 client := github .NewClient (httpClient )
@@ -95,7 +96,7 @@ func (gm *githubManager) ChangeBranchHead(owner, repo, branch, sha string, force
9596 return nil
9697}
9798
98- func hydrateCommits (q * githubQuery ) ( []Commit ) {
99+ func hydrateCommits (q * githubQuery ) []Commit {
99100 var fullCommitsList []Commit
100101 for _ , edge := range q .Repository .Ref .Target .Commit .History .Edges {
101102 var parents []Commit
@@ -105,11 +106,12 @@ func hydrateCommits(q *githubQuery) ([]Commit) {
105106 Message : string (parent .Node .Message ),
106107 })
107108 }
109+
108110 fullCommitsList = append (fullCommitsList , Commit {
109111 SHA : string (edge .Node .Oid ),
110112 Message : string (edge .Node .Message ),
111113 Parents : parents ,
112- StatusSuccess : bool (edge .Node .Status .State == githubql .String (githubql .StatusStateSuccess )),
114+ StatusSuccess : bool (edge .Node .StatusCheckRollup .State == githubql .String (githubql .StatusStateSuccess )),
113115 PushedDate : edge .Node .PushedDate .Time ,
114116 })
115117 }
0 commit comments