(ctx context.Context, gitcmd git.GitInterface)
| 188 | } |
| 189 | |
| 190 | func (c *client) GetInfo(ctx context.Context, gitcmd git.GitInterface) *github.GitHubInfo { |
| 191 | if c.config.User.LogGitHubCalls { |
| 192 | fmt.Printf("> github fetch pull requests\n") |
| 193 | } |
| 194 | |
| 195 | var pullRequestConnection fezzik_types.PullRequestConnection |
| 196 | var loginName string |
| 197 | var repoID string |
| 198 | if c.config.Repo.MergeQueue { |
| 199 | resp, err := c.api.PullRequestsWithMergeQueue(ctx, |
| 200 | c.config.Repo.GitHubRepoOwner, |
| 201 | c.config.Repo.GitHubRepoName) |
| 202 | check(err) |
| 203 | pullRequestConnection = resp.Viewer.PullRequests |
| 204 | loginName = resp.Viewer.Login |
| 205 | repoID = resp.Repository.Id |
| 206 | } else { |
| 207 | resp, err := c.api.PullRequests(ctx, |
| 208 | c.config.Repo.GitHubRepoOwner, |
| 209 | c.config.Repo.GitHubRepoName) |
| 210 | check(err) |
| 211 | pullRequestConnection = resp.Viewer.PullRequests |
| 212 | loginName = resp.Viewer.Login |
| 213 | repoID = resp.Repository.Id |
| 214 | } |
| 215 | |
| 216 | targetBranch := c.config.Repo.GitHubBranch |
| 217 | localCommitStack := git.GetLocalCommitStack(c.config, gitcmd) |
| 218 | |
| 219 | pullRequests := matchPullRequestStack(c.config.Repo, c.config.User.BranchPrefix, targetBranch, localCommitStack, pullRequestConnection) |
| 220 | |
| 221 | // When RequiredChecks is explicitly configured, fetch individual check contexts |
| 222 | // and only evaluate the listed checks. This allows non-required check failures |
| 223 | // to be ignored. When RequiredChecks is not set, the statusCheckRollup.state |
| 224 | // from the fezzik query is used as-is (all checks matter). |
| 225 | if c.config.Repo.RequireChecks && len(c.config.Repo.RequiredChecks) > 0 && len(pullRequests) > 0 { |
| 226 | requiredStatus := c.fetchRequiredChecksStatus(ctx, pullRequests) |
| 227 | if requiredStatus != nil { |
| 228 | for _, pr := range pullRequests { |
| 229 | if status, ok := requiredStatus[pr.Number]; ok { |
| 230 | pr.MergeStatus.ChecksPass = status |
| 231 | } |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | for _, pr := range pullRequests { |
| 237 | if pr.Ready(c.config) { |
| 238 | pr.MergeStatus.Stacked = true |
| 239 | } else { |
| 240 | break |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | info := &github.GitHubInfo{ |
| 245 | UserName: loginName, |
| 246 | RepositoryID: repoID, |
| 247 | LocalBranch: git.GetLocalBranchName(gitcmd), |
nothing calls this directly
no test coverage detected