func setStatus(status *github.RepoStatus, success bool) { if success { status.State = stringPtr("success") } else { status.State = stringPtr("failure") } }
func (l *Linter) rebasedStatus(pr *github.PullRequest) (github.RepoStatus, error) { base := *pr.Base.Label head := *pr.Head.Label owner := *pr.Base.Repo.Owner.Login repo := *pr.Base.Repo.Name comp, _, err := l.client.Repositories.CompareCommits(owner, repo, base, head) if err != nil { return github.RepoStatus{}, fmt.Errorf("Error during comparing commits: %s", err) } rebased := *comp.BehindBy == 0 var status github.RepoStatus state := map[bool]string{true: "success", false: "failure"}[rebased] status.State = &state status.Description = &rebaseDescripton status.Context = &integrationName return status, nil }