Skip to content

Commit

Permalink
fix: get resource by removing status from commitobject
Browse files Browse the repository at this point in the history
  • Loading branch information
jmccann committed Oct 27, 2020
1 parent 2d71da5 commit e3fc941
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 5 additions & 2 deletions github.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ func (m *GithubClient) ListOpenPullRequests() ([]*PullRequest, error) {
Commits struct {
Edges []struct {
Node struct {
Commit CommitObject
Commit struct {
CommitObject
Status StatusObject
}
}
}
} `graphql:"commits(last:$commitsLast)"`
Expand Down Expand Up @@ -160,7 +163,7 @@ func (m *GithubClient) ListOpenPullRequests() ([]*PullRequest, error) {
for _, c := range p.Node.Commits.Edges {
response = append(response, &PullRequest{
PullRequestObject: p.Node.PullRequestObject,
Tip: c.Node.Commit,
Tip: c.Node.Commit.CommitObject,
ApprovedReviewCount: p.Node.Reviews.TotalCount,
Labels: labels,
HasStatus: !(c.Node.Commit.Status.Context.Context == nil),
Expand Down
13 changes: 8 additions & 5 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,14 @@ type CommitObject struct {
}
Email string
}
Status struct {
Context struct {
Context *githubv4.String
} `graphql:"context(name:$statusContextName)"`
}
}

// StatusObject represents the GraphQL FilesChanged node.
// https://developer.github.com/v4/object/status/
type StatusObject struct {
Context struct {
Context *githubv4.String
} `graphql:"context(name:$statusContextName)"`
}

// ChangedFileObject represents the GraphQL FilesChanged node.
Expand Down

0 comments on commit e3fc941

Please sign in to comment.