adds merge state status

This commit is contained in:
Michael Neeley 2021-02-11 16:27:23 -05:00
parent 5af2dca351
commit 0d55f8648c
3 changed files with 13 additions and 0 deletions

View file

@ -239,6 +239,7 @@ func (c Client) GraphQL(hostname string, query string, variables map[string]inte
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.Header.Set("Accept", "application/vnd.github.merge-info-preview+json")
resp, err := c.http.Do(req)
if err != nil {

View file

@ -38,6 +38,7 @@ type PullRequest struct {
HeadRefName string
Body string
Mergeable string
MergeStateStatus string
Author struct {
Login string
@ -353,6 +354,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
state
url
headRefName
mergeStateStatus
headRepositoryOwner {
login
}

View file

@ -227,6 +227,16 @@ func printPrs(io *iostreams.IOStreams, totalCount int, prs ...api.PullRequest) {
} else if reviews.Approved {
fmt.Fprint(w, cs.Green("✓ Approved"))
}
// add padding between reviews & merge status
fmt.Fprint(w, " ")
if pr.MergeStateStatus == "BEHIND" {
fmt.Fprint(w, cs.Yellow("- Not up to date"))
} else {
fmt.Fprint(w, cs.Green("✓ Up to date"))
}
} else {
fmt.Fprintf(w, " - %s", shared.StateTitleWithColor(cs, pr))
}