Merge pull request #667 from doi-t/view-the-current-state

Show the state (open, closed, merged) in issue view and pr view
This commit is contained in:
Mislav Marohnić 2020-04-03 19:41:29 +02:00 committed by GitHub
commit e10ccefaf5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 496 additions and 155 deletions

View file

@ -24,6 +24,7 @@ type Issue struct {
URL string
State string
Body string
CreatedAt time.Time
UpdatedAt time.Time
Comments struct {
TotalCount int
@ -278,6 +279,7 @@ func IssueByNumber(client *Client, repo ghrepo.Interface, number int) (*Issue, e
hasIssuesEnabled
issue(number: $issue_number) {
title
state
body
author {
login
@ -292,6 +294,7 @@ func IssueByNumber(client *Client, repo ghrepo.Interface, number int) (*Issue, e
}
number
url
createdAt
}
}
}`

View file

@ -301,6 +301,7 @@ func PullRequestByNumber(client *Client, repo ghrepo.Interface, number int) (*Pu
url
number
title
state
body
author {
login
@ -320,6 +321,7 @@ func PullRequestByNumber(client *Client, repo ghrepo.Interface, number int) (*Pu
}
}
isCrossRepository
isDraft
maintainerCanModify
}
}
@ -356,6 +358,7 @@ func PullRequestForBranch(client *Client, repo ghrepo.Interface, baseBranch, hea
nodes {
number
title
state
body
author {
login

View file

@ -228,6 +228,11 @@ func issueView(cmd *cobra.Command, args []string) error {
}
func issueStateTitleWithColor(state string) string {
colorFunc := colorFuncForState(state)
return colorFunc(strings.Title(strings.ToLower(state)))
}
func listHeader(repoName string, itemName string, matchCount int, totalMatchCount int, hasFilters bool) string {
if totalMatchCount == 0 {
if hasFilters {
@ -248,17 +253,16 @@ func listHeader(repoName string, itemName string, matchCount int, totalMatchCoun
}
func printIssuePreview(out io.Writer, issue *api.Issue) error {
coloredLabels := labelList(*issue)
if coloredLabels != "" {
coloredLabels = utils.Gray(fmt.Sprintf("(%s)", coloredLabels))
}
now := time.Now()
ago := now.Sub(issue.CreatedAt)
fmt.Fprintln(out, utils.Bold(issue.Title))
fmt.Fprintf(out, "%s", issueStateTitleWithColor(issue.State))
fmt.Fprintln(out, utils.Gray(fmt.Sprintf(
"opened by %s. %s. %s",
" • %s opened %s • %s",
issue.Author.Login,
utils.FuzzyAgo(ago),
utils.Pluralize(issue.Comments.TotalCount, "comment"),
coloredLabels,
)))
if issue.Body != "" {

View file

@ -12,6 +12,7 @@ import (
"github.com/cli/cli/internal/run"
"github.com/cli/cli/test"
"github.com/google/go-cmp/cmp"
)
func TestIssueStatus(t *testing.T) {
@ -284,81 +285,77 @@ func TestIssueView_web_numberArgWithHash(t *testing.T) {
eq(t, url, "https://github.com/OWNER/REPO/issues/123")
}
func TestIssueView(t *testing.T) {
initBlankContext("OWNER/REPO", "master")
http := initFakeHTTP()
http.StubRepoResponse("OWNER", "REPO")
http.StubResponse(200, bytes.NewBufferString(`
{ "data": { "repository": { "hasIssuesEnabled": true, "issue": {
"number": 123,
"body": "**bold story**",
"title": "ix of coins",
"author": {
"login": "marseilles"
func TestIssueView_Preview(t *testing.T) {
tests := map[string]struct {
ownerRepo string
command string
fixture string
expectedOutputs []string
}{
"Open issue": {
ownerRepo: "master",
command: "issue view 123",
fixture: "../test/fixtures/issueView_preview.json",
expectedOutputs: []string{
"ix of coins",
"Open • marseilles opened about 292 years ago • 9 comments",
"bold story",
"View this issue on GitHub: https://github.com/OWNER/REPO/issues/123",
},
},
"labels": {
"nodes": [
{"name": "tarot"}
]
"Open issue with no label": {
ownerRepo: "master",
command: "issue view 123",
fixture: "../test/fixtures/issueView_previewNoLabel.json",
expectedOutputs: []string{
"ix of coins",
"Open • marseilles opened about 292 years ago • 9 comments",
"bold story",
"View this issue on GitHub: https://github.com/OWNER/REPO/issues/123",
},
},
"comments": {
"totalCount": 9
"Open issue with empty body": {
ownerRepo: "master",
command: "issue view 123",
fixture: "../test/fixtures/issueView_previewWithEmptyBody.json",
expectedOutputs: []string{
"ix of coins",
"Open • marseilles opened about 292 years ago • 9 comments",
"View this issue on GitHub: https://github.com/OWNER/REPO/issues/123",
},
},
"Closed issue": {
ownerRepo: "master",
command: "issue view 123",
fixture: "../test/fixtures/issueView_previewClosedState.json",
expectedOutputs: []string{
"ix of coins",
"Closed • marseilles opened about 292 years ago • 9 comments",
"bold story",
"View this issue on GitHub: https://github.com/OWNER/REPO/issues/123",
},
},
"url": "https://github.com/OWNER/REPO/issues/123"
} } } }
`))
output, err := RunCommand(issueViewCmd, "issue view 123")
if err != nil {
t.Errorf("error running command `issue view`: %v", err)
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
initBlankContext("OWNER/REPO", tc.ownerRepo)
http := initFakeHTTP()
http.StubRepoResponse("OWNER", "REPO")
eq(t, output.Stderr(), "")
jsonFile, _ := os.Open(tc.fixture)
defer jsonFile.Close()
http.StubResponse(200, jsonFile)
test.ExpectLines(t, output.String(),
"ix of coins",
`opened by marseilles. 9 comments. \(tarot\)`,
"bold story",
"View this issue on GitHub: https://github.com/OWNER/REPO/issues/123")
}
output, err := RunCommand(issueViewCmd, tc.command)
if err != nil {
t.Errorf("error running command `%v`: %v", tc.command, err)
}
func TestIssueView_WithEmptyBody(t *testing.T) {
initBlankContext("OWNER/REPO", "master")
http := initFakeHTTP()
http.StubRepoResponse("OWNER", "REPO")
eq(t, output.Stderr(), "")
http.StubResponse(200, bytes.NewBufferString(`
{ "data": { "repository": { "hasIssuesEnabled": true, "issue": {
"number": 123,
"body": "",
"title": "ix of coins",
"author": {
"login": "marseilles"
},
"labels": {
"nodes": [
{"name": "tarot"}
]
},
"comments": {
"totalCount": 9
},
"url": "https://github.com/OWNER/REPO/issues/123"
} } } }
`))
output, err := RunCommand(issueViewCmd, "issue view 123")
if err != nil {
t.Errorf("error running command `issue view`: %v", err)
test.ExpectLines(t, output.String(), tc.expectedOutputs...)
})
}
eq(t, output.Stderr(), "")
test.ExpectLines(t, output.String(),
"ix of coins",
`opened by marseilles. 9 comments. \(tarot\)`,
"View this issue on GitHub: https://github.com/OWNER/REPO/issues/123")
}
func TestIssueView_web_notFound(t *testing.T) {
@ -659,3 +656,23 @@ func Test_listHeader(t *testing.T) {
})
}
}
func TestIssueStateTitleWithColor(t *testing.T) {
tests := map[string]struct {
state string
want string
}{
"Open state": {state: "OPEN", want: "Open"},
"Closed state": {state: "CLOSED", want: "Closed"},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
got := issueStateTitleWithColor(tc.state)
diff := cmp.Diff(tc.want, got)
if diff != "" {
t.Fatalf(diff)
}
})
}
}

View file

@ -226,14 +226,22 @@ func prList(cmd *cobra.Command, args []string) error {
return nil
}
func prStateTitleWithColor(pr api.PullRequest) string {
prStateColorFunc := colorFuncForPR(pr)
if pr.State == "OPEN" && pr.IsDraft {
return prStateColorFunc(strings.Title(strings.ToLower("Draft")))
}
return prStateColorFunc(strings.Title(strings.ToLower(pr.State)))
}
func colorFuncForPR(pr api.PullRequest) func(string) string {
if pr.State == "OPEN" && pr.IsDraft {
return utils.Gray
} else {
return colorFuncForState(pr.State)
}
return colorFuncForState(pr.State)
}
// colorFuncForState returns a color function for a PR/Issue state
func colorFuncForState(state string) func(string) string {
switch state {
case "OPEN":
@ -320,8 +328,9 @@ func prView(cmd *cobra.Command, args []string) error {
func printPrPreview(out io.Writer, pr *api.PullRequest) error {
fmt.Fprintln(out, utils.Bold(pr.Title))
fmt.Fprintf(out, "%s", prStateTitleWithColor(*pr))
fmt.Fprintln(out, utils.Gray(fmt.Sprintf(
"%s wants to merge %s into %s from %s",
"%s wants to merge %s into %s from %s",
pr.Author.Login,
utils.Pluralize(pr.Commits.TotalCount, "commit"),
pr.BaseRefName,
@ -453,8 +462,7 @@ func printPrs(w io.Writer, totalCount int, prs ...api.PullRequest) {
fmt.Fprint(w, utils.Green("✓ Approved"))
}
} else {
s := strings.Title(strings.ToLower(pr.State))
fmt.Fprintf(w, " - %s", prStateColorFunc(s))
fmt.Fprintf(w, " - %s", prStateTitleWithColor(pr))
}
fmt.Fprint(w, "\n")

View file

@ -11,8 +11,10 @@ import (
"strings"
"testing"
"github.com/cli/cli/api"
"github.com/cli/cli/internal/run"
"github.com/cli/cli/test"
"github.com/google/go-cmp/cmp"
"github.com/google/shlex"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@ -400,82 +402,111 @@ func TestPRList_filteringAssigneeLabels(t *testing.T) {
}
}
func TestPRView_preview(t *testing.T) {
initBlankContext("OWNER/REPO", "master")
http := initFakeHTTP()
http.StubRepoResponse("OWNER", "REPO")
jsonFile, _ := os.Open("../test/fixtures/prViewPreview.json")
defer jsonFile.Close()
http.StubResponse(200, jsonFile)
output, err := RunCommand(prViewCmd, "pr view 12")
if err != nil {
t.Errorf("error running command `pr view`: %v", err)
func TestPRView_Preview(t *testing.T) {
tests := map[string]struct {
ownerRepo string
args string
fixture string
expectedOutputs []string
}{
"Open PR": {
ownerRepo: "master",
args: "pr view 12",
fixture: "../test/fixtures/prViewPreview.json",
expectedOutputs: []string{
"Blueberries are from a fork",
"Open • nobody wants to merge 12 commits into master from blueberries",
"blueberries taste good",
"View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12",
},
},
"Open PR for the current branch": {
ownerRepo: "blueberries",
args: "pr view",
fixture: "../test/fixtures/prView.json",
expectedOutputs: []string{
"Blueberries are a good fruit",
"Open • nobody wants to merge 8 commits into master from blueberries",
"blueberries taste good",
"View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10",
},
},
"Open PR wth empty body for the current branch": {
ownerRepo: "blueberries",
args: "pr view",
fixture: "../test/fixtures/prView_EmptyBody.json",
expectedOutputs: []string{
"Blueberries are a good fruit",
"Open • nobody wants to merge 8 commits into master from blueberries",
"View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10",
},
},
"Closed PR": {
ownerRepo: "master",
args: "pr view 12",
fixture: "../test/fixtures/prViewPreviewClosedState.json",
expectedOutputs: []string{
"Blueberries are from a fork",
"Closed • nobody wants to merge 12 commits into master from blueberries",
"blueberries taste good",
"View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12",
},
},
"Merged PR": {
ownerRepo: "master",
args: "pr view 12",
fixture: "../test/fixtures/prViewPreviewMergedState.json",
expectedOutputs: []string{
"Blueberries are from a fork",
"Merged • nobody wants to merge 12 commits into master from blueberries",
"blueberries taste good",
"View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12",
},
},
"Draft PR": {
ownerRepo: "master",
args: "pr view 12",
fixture: "../test/fixtures/prViewPreviewDraftState.json",
expectedOutputs: []string{
"Blueberries are from a fork",
"Draft • nobody wants to merge 12 commits into master from blueberries",
"blueberries taste good",
"View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12",
},
},
"Draft PR by branch": {
ownerRepo: "master",
args: "pr view blueberries",
fixture: "../test/fixtures/prViewPreviewDraftStatebyBranch.json",
expectedOutputs: []string{
"Blueberries are a good fruit",
"Draft • nobody wants to merge 8 commits into master from blueberries",
"blueberries taste good",
"View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10",
},
},
}
eq(t, output.Stderr(), "")
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
initBlankContext("OWNER/REPO", tc.ownerRepo)
http := initFakeHTTP()
http.StubRepoResponse("OWNER", "REPO")
test.ExpectLines(t, output.String(),
"Blueberries are from a fork",
"nobody wants to merge 12 commits into master from blueberries",
"blueberries taste good",
"View this pull request on GitHub: https://github.com/OWNER/REPO/pull/12")
}
jsonFile, _ := os.Open(tc.fixture)
defer jsonFile.Close()
http.StubResponse(200, jsonFile)
func TestPRView_previewCurrentBranch(t *testing.T) {
initBlankContext("OWNER/REPO", "blueberries")
http := initFakeHTTP()
http.StubRepoResponse("OWNER", "REPO")
output, err := RunCommand(prViewCmd, tc.args)
if err != nil {
t.Errorf("error running command `%v`: %v", tc.args, err)
}
jsonFile, _ := os.Open("../test/fixtures/prView.json")
defer jsonFile.Close()
http.StubResponse(200, jsonFile)
eq(t, output.Stderr(), "")
restoreCmd := run.SetPrepareCmd(func(cmd *exec.Cmd) run.Runnable {
return &test.OutputStub{}
})
defer restoreCmd()
output, err := RunCommand(prViewCmd, "pr view")
if err != nil {
t.Errorf("error running command `pr view`: %v", err)
test.ExpectLines(t, output.String(), tc.expectedOutputs...)
})
}
eq(t, output.Stderr(), "")
test.ExpectLines(t, output.String(),
"Blueberries are a good fruit",
"nobody wants to merge 8 commits into master from blueberries",
"blueberries taste good",
"View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10")
}
func TestPRView_previewCurrentBranchWithEmptyBody(t *testing.T) {
initBlankContext("OWNER/REPO", "blueberries")
http := initFakeHTTP()
http.StubRepoResponse("OWNER", "REPO")
jsonFile, _ := os.Open("../test/fixtures/prView_EmptyBody.json")
defer jsonFile.Close()
http.StubResponse(200, jsonFile)
restoreCmd := run.SetPrepareCmd(func(cmd *exec.Cmd) run.Runnable {
return &test.OutputStub{}
})
defer restoreCmd()
output, err := RunCommand(prViewCmd, "pr view")
if err != nil {
t.Errorf("error running command `pr view`: %v", err)
}
eq(t, output.Stderr(), "")
test.ExpectLines(t, output.String(),
"Blueberries are a good fruit",
"nobody wants to merge 8 commits into master from blueberries",
"View this pull request on GitHub: https://github.com/OWNER/REPO/pull/10")
}
func TestPRView_web_currentBranch(t *testing.T) {
@ -717,3 +748,25 @@ func TestReplaceExcessiveWhitespace(t *testing.T) {
eq(t, replaceExcessiveWhitespace("hello goodbye"), "hello goodbye")
eq(t, replaceExcessiveWhitespace(" hello \n goodbye "), "hello goodbye")
}
func TestPrStateTitleWithColor(t *testing.T) {
tests := map[string]struct {
pr api.PullRequest
want string
}{
"Format OPEN state": {pr: api.PullRequest{State: "OPEN", IsDraft: false}, want: "Open"},
"Format OPEN state for Draft PR": {pr: api.PullRequest{State: "OPEN", IsDraft: true}, want: "Draft"},
"Format CLOSED state": {pr: api.PullRequest{State: "CLOSED", IsDraft: false}, want: "Closed"},
"Format MERGED state": {pr: api.PullRequest{State: "MERGED", IsDraft: false}, want: "Merged"},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
got := prStateTitleWithColor(tc.pr)
diff := cmp.Diff(tc.want, got)
if diff != "" {
t.Fatalf(diff)
}
})
}
}

1
go.mod
View file

@ -7,6 +7,7 @@ require (
github.com/briandowns/spinner v1.9.0
github.com/charmbracelet/glamour v0.1.1-0.20200320173916-301d3bcf3058
github.com/dlclark/regexp2 v1.2.0 // indirect
github.com/google/go-cmp v0.2.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/hashicorp/go-version v1.2.0
github.com/henvic/httpretty v0.0.4

1
go.sum
View file

@ -61,6 +61,7 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/goterm v0.0.0-20190703233501-fc88cf888a3f h1:5CjVwnuUcp5adK4gmY6i72gpVFVnZDP2h5TmPScB6u4=
github.com/google/goterm v0.0.0-20190703233501-fc88cf888a3f/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4=

28
test/fixtures/issueView_preview.json vendored Normal file
View file

@ -0,0 +1,28 @@
{
"data": {
"repository": {
"hasIssuesEnabled": true,
"issue": {
"number": 123,
"body": "**bold story**",
"title": "ix of coins",
"state": "OPEN",
"created_at": "2011-01-26T19:01:12Z",
"author": {
"login": "marseilles"
},
"labels": {
"nodes": [
{
"name": "tarot"
}
]
},
"comments": {
"totalCount": 9
},
"url": "https://github.com/OWNER/REPO/issues/123"
}
}
}
}

View file

@ -0,0 +1,28 @@
{
"data": {
"repository": {
"hasIssuesEnabled": true,
"issue": {
"number": 123,
"body": "**bold story**",
"title": "ix of coins",
"state": "CLOSED",
"created_at": "2011-01-26T19:01:12Z",
"author": {
"login": "marseilles"
},
"labels": {
"nodes": [
{
"name": "tarot"
}
]
},
"comments": {
"totalCount": 9
},
"url": "https://github.com/OWNER/REPO/issues/123"
}
}
}
}

View file

@ -0,0 +1,25 @@
{
"data": {
"repository": {
"hasIssuesEnabled": true,
"issue": {
"number": 123,
"body": "**bold story**",
"title": "ix of coins",
"state": "OPEN",
"created_at": "2011-01-26T19:01:12Z",
"author": {
"login": "marseilles"
},
"labels": {
"nodes": [
]
},
"comments": {
"totalCount": 9
},
"url": "https://github.com/OWNER/REPO/issues/123"
}
}
}
}

View file

@ -0,0 +1,28 @@
{
"data": {
"repository": {
"hasIssuesEnabled": true,
"issue": {
"number": 123,
"body": "",
"title": "ix of coins",
"state": "OPEN",
"created_at": "2011-01-26T19:01:12Z",
"author": {
"login": "marseilles"
},
"labels": {
"nodes": [
{
"name": "tarot"
}
]
},
"comments": {
"totalCount": 9
},
"url": "https://github.com/OWNER/REPO/issues/123"
}
}
}
}

View file

@ -8,8 +8,10 @@
"node": {
"number": 10,
"title": "Blueberries are a good fruit",
"state": "OPEN",
"url": "https://github.com/cli/cli/pull/10",
"headRefName": "blueberries",
"isDraft": false,
"headRepositoryOwner": {
"login": "OWNER"
},
@ -26,8 +28,10 @@
"node": {
"number": 8,
"title": "Strawberries are not actually berries",
"state": "OPEN",
"url": "https://github.com/cli/cli/pull/8",
"headRefName": "strawberries"
"headRefName": "strawberries",
"isDraft": false
}
}
]
@ -39,16 +43,18 @@
"node": {
"number": 9,
"title": "Apples are tasty",
"state": "OPEN",
"url": "https://github.com/cli/cli/pull/9",
"headRefName": "apples"
}
},
{
"headRefName": "apples",
"isDraft": false
} }, {
"node": {
"number": 11,
"title": "Figs are my favorite",
"state": "OPEN",
"url": "https://github.com/cli/cli/pull/1",
"headRefName": "figs"
"headRefName": "figs",
"isDraft": true
}
}
]

View file

@ -8,8 +8,10 @@
"node": {
"number": 10,
"title": "Blueberries are a good fruit",
"state": "OPEN",
"url": "https://github.com/PARENT/REPO/pull/10",
"headRefName": "blueberries",
"isDraft": false,
"headRepositoryOwner": {
"login": "OWNER"
},

View file

@ -6,6 +6,7 @@
{
"number": 12,
"title": "Blueberries are from a fork",
"state": "OPEN",
"body": "yeah",
"url": "https://github.com/OWNER/REPO/pull/12",
"headRefName": "blueberries",
@ -19,11 +20,13 @@
"author": {
"login": "nobody"
},
"isCrossRepository": true
"isCrossRepository": true,
"isDraft": false
},
{
"number": 10,
"title": "Blueberries are a good fruit",
"state": "OPEN",
"body": "**blueberries taste good**",
"url": "https://github.com/OWNER/REPO/pull/10",
"baseRefName": "master",
@ -37,7 +40,8 @@
"commits": {
"totalCount": 8
},
"isCrossRepository": false
"isCrossRepository": false,
"isDraft": false
}
]
}

View file

@ -4,6 +4,7 @@
"pullRequest": {
"number": 12,
"title": "Blueberries are from a fork",
"state": "OPEN",
"body": "**blueberries taste good**",
"url": "https://github.com/OWNER/REPO/pull/12",
"author": {
@ -17,7 +18,8 @@
"headRepositoryOwner": {
"login": "hubot"
},
"isCrossRepository": true
"isCrossRepository": true,
"isDraft": false
}
}
}

View file

@ -0,0 +1,25 @@
{
"data": {
"repository": {
"pullRequest": {
"number": 12,
"title": "Blueberries are from a fork",
"state": "CLOSED",
"body": "**blueberries taste good**",
"url": "https://github.com/OWNER/REPO/pull/12",
"author": {
"login": "nobody"
},
"commits": {
"totalCount": 12
},
"baseRefName": "master",
"headRefName": "blueberries",
"headRepositoryOwner": {
"login": "hubot"
},
"isCrossRepository": true
}
}
}
}

View file

@ -0,0 +1,26 @@
{
"data": {
"repository": {
"pullRequest": {
"number": 12,
"title": "Blueberries are from a fork",
"state": "OPEN",
"body": "**blueberries taste good**",
"url": "https://github.com/OWNER/REPO/pull/12",
"author": {
"login": "nobody"
},
"commits": {
"totalCount": 12
},
"baseRefName": "master",
"headRefName": "blueberries",
"headRepositoryOwner": {
"login": "hubot"
},
"isCrossRepository": true,
"isDraft": true
}
}
}
}

View file

@ -0,0 +1,50 @@
{
"data": {
"repository": {
"pullRequests": {
"nodes": [
{
"number": 12,
"title": "Blueberries are from a fork",
"state": "OPEN",
"body": "yeah",
"url": "https://github.com/OWNER/REPO/pull/12",
"headRefName": "blueberries",
"baseRefName": "master",
"headRepositoryOwner": {
"login": "hubot"
},
"commits": {
"totalCount": 12
},
"author": {
"login": "nobody"
},
"isCrossRepository": true,
"isDraft": false
},
{
"number": 10,
"title": "Blueberries are a good fruit",
"state": "OPEN",
"body": "**blueberries taste good**",
"url": "https://github.com/OWNER/REPO/pull/10",
"baseRefName": "master",
"headRefName": "blueberries",
"author": {
"login": "nobody"
},
"headRepositoryOwner": {
"login": "OWNER"
},
"commits": {
"totalCount": 8
},
"isCrossRepository": false,
"isDraft": true
}
]
}
}
}
}

View file

@ -0,0 +1,25 @@
{
"data": {
"repository": {
"pullRequest": {
"number": 12,
"title": "Blueberries are from a fork",
"state": "MERGED",
"body": "**blueberries taste good**",
"url": "https://github.com/OWNER/REPO/pull/12",
"author": {
"login": "nobody"
},
"commits": {
"totalCount": 12
},
"baseRefName": "master",
"headRefName": "blueberries",
"headRepositoryOwner": {
"login": "hubot"
},
"isCrossRepository": true
}
}
}
}

View file

@ -6,6 +6,7 @@
{
"number": 12,
"title": "Blueberries are from a fork",
"state": "OPEN",
"body": "yeah",
"url": "https://github.com/OWNER/REPO/pull/12",
"headRefName": "blueberries",
@ -24,6 +25,7 @@
{
"number": 10,
"title": "Blueberries are a good fruit",
"state": "OPEN",
"body": "",
"url": "https://github.com/OWNER/REPO/pull/10",
"baseRefName": "master",