Skip to content

Commit 0d55f86

Browse files
committed
adds merge state status
1 parent 5af2dca commit 0d55f86

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

api/client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ func (c Client) GraphQL(hostname string, query string, variables map[string]inte
239239
}
240240

241241
req.Header.Set("Content-Type", "application/json; charset=utf-8")
242+
req.Header.Set("Accept", "application/vnd.github.merge-info-preview+json")
242243

243244
resp, err := c.http.Do(req)
244245
if err != nil {

api/queries_pr.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type PullRequest struct {
3838
HeadRefName string
3939
Body string
4040
Mergeable string
41+
MergeStateStatus string
4142

4243
Author struct {
4344
Login string
@@ -353,6 +354,7 @@ func PullRequests(client *Client, repo ghrepo.Interface, currentPRNumber int, cu
353354
state
354355
url
355356
headRefName
357+
mergeStateStatus
356358
headRepositoryOwner {
357359
login
358360
}

pkg/cmd/pr/status/status.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,16 @@ func printPrs(io *iostreams.IOStreams, totalCount int, prs ...api.PullRequest) {
227227
} else if reviews.Approved {
228228
fmt.Fprint(w, cs.Green("✓ Approved"))
229229
}
230+
231+
// add padding between reviews & merge status
232+
fmt.Fprint(w, " ")
233+
234+
if pr.MergeStateStatus == "BEHIND" {
235+
fmt.Fprint(w, cs.Yellow("- Not up to date"))
236+
} else {
237+
fmt.Fprint(w, cs.Green("✓ Up to date"))
238+
}
239+
230240
} else {
231241
fmt.Fprintf(w, " - %s", shared.StateTitleWithColor(cs, pr))
232242
}

0 commit comments

Comments
 (0)