(params *models.ChecksParams)
| 64 | } |
| 65 | |
| 66 | func (gu *githubUsecase) Checks(params *models.ChecksParams) (*coreModels.Tile, error) { |
| 67 | tile := coreModels.NewTile(api.GithubChecksTileType).WithBuild() |
| 68 | tile.Label = params.Repository |
| 69 | tile.Build.Branch = pointer.ToString(git.HumanizeBranch(params.Ref)) |
| 70 | |
| 71 | // Request checks |
| 72 | checks, err := gu.repository.GetChecks(params.Owner, params.Repository, params.Ref) |
| 73 | if err != nil { |
| 74 | return nil, &coreModels.MonitororError{Err: err, Tile: tile, Message: "unable to load ref checks"} |
| 75 | } |
| 76 | if len(checks.Statuses) == 0 && len(checks.Runs) == 0 { |
| 77 | // Warning because request was correct but there is no build |
| 78 | return nil, &coreModels.MonitororError{Tile: tile, Message: "no ref checks found", ErrorStatus: coreModels.UnknownStatus} |
| 79 | } |
| 80 | |
| 81 | // Compute checks into tile |
| 82 | gu.computeRefChecks(tile, checks, params.String()) |
| 83 | |
| 84 | // Author of last commit |
| 85 | if tile.Status == coreModels.FailedStatus && checks.HeadCommit != nil { |
| 86 | commit, err := gu.repository.GetCommit(params.Owner, params.Repository, *checks.HeadCommit) |
| 87 | if err == nil { |
| 88 | tile.Build.Author = &coreModels.Author{ |
| 89 | Name: commit.Author.Name, |
| 90 | AvatarURL: commit.Author.AvatarURL, |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | return tile, nil |
| 96 | } |
| 97 | |
| 98 | func (gu *githubUsecase) PullRequest(params *models.PullRequestParams) (*coreModels.Tile, error) { |
| 99 | tile := coreModels.NewTile(api.GithubPullRequestTileType).WithBuild() |
nothing calls this directly
no test coverage detected