mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-08-28 18:24:17 -05:00
GitHub exposes a combined status for the head commit without requiring individual check contexts. Include that rollup in the existing request and startup cache so every consumer sees the same state without making a second network request.
26 lines
809 B
Go
26 lines
809 B
Go
package models
|
|
|
|
type GithubPullRequest struct {
|
|
HeadRefName string `json:"headRefName"`
|
|
Number int `json:"number"`
|
|
Title string `json:"title"`
|
|
State string `json:"state"` // "MERGED", "OPEN", "CLOSED", "DRAFT"
|
|
ChecksState string `json:"checksState"`
|
|
Url string `json:"url"`
|
|
HeadRepositoryOwner GithubRepositoryOwner `json:"headRepositoryOwner"`
|
|
}
|
|
|
|
func (pr *GithubPullRequest) UserName() string {
|
|
// e.g. 'jesseduffield'
|
|
return pr.HeadRepositoryOwner.Login
|
|
}
|
|
|
|
func (pr *GithubPullRequest) BranchName() string {
|
|
// e.g. 'feature/my-feature'
|
|
return pr.HeadRefName
|
|
}
|
|
|
|
type GithubRepositoryOwner struct {
|
|
Login string `json:"login"`
|
|
}
|