Repository: google/go-github
Pull request #1269 (2019-08-30 13:33:15)

add missing fields to PullRequest: locked and rebaseable
Fix: https://github.com/google/go-github/issues/1264

Also added another missing field which is the `locked`

/cc @gmlewis 

codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/1269?src=pr&el=h1) Report
> Merging [#1269](https://codecov.io/gh/google/go-github/pull/1269?src=pr&el=desc) into [master](https://codecov.io/gh/google/go-github/commit/cc20b8df44a10cf7439649ec5a2192f06e97fe43?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/google/go-github/pull/1269/graphs/tree.svg?width=650&token=EgYjGjZlI0&height=150&src=pr)](https://codecov.io/gh/google/go-github/pull/1269?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1269   +/-   ##
=======================================
  Coverage   73.42%   73.42%           
=======================================
  Files          86       86           
  Lines        6040     6040           
=======================================
  Hits         4435     4435           
  Misses        836      836           
  Partials      769      769
```


| [Impacted Files](https://codecov.io/gh/google/go-github/pull/1269?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [github/pulls.go](https://codecov.io/gh/google/go-github/pull/1269/diff?src=pr&el=tree#diff-Z2l0aHViL3B1bGxzLmdv) | `71.42% <ø> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/1269?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/google/go-github/pull/1269?src=pr&el=footer). Last update [cc20b8d...1a277b7](https://codecov.io/gh/google/go-github/pull/1269?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 03fd93f9..02112173 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -7644,6 +7644,14 @@ func (p *PullRequest) GetLinks() *PRLinks {
 	return p.Links
 }
 
+// GetLocked returns the Locked field if it's non-nil, zero value otherwise.
+func (p *PullRequest) GetLocked() bool {
+	if p == nil || p.Locked == nil {
+		return false
+	}
+	return *p.Locked
+}
+
 // GetMaintainerCanModify returns the MaintainerCanModify field if it's non-nil, zero value otherwise.
 func (p *PullRequest) GetMaintainerCanModify() bool {
 	if p == nil || p.MaintainerCanModify == nil {
@@ -7732,6 +7740,14 @@ func (p *PullRequest) GetPatchURL() string {
 	return *p.PatchURL
 }
 
+// GetRebaseable returns the Rebaseable field if it's non-nil, zero value otherwise.
+func (p *PullRequest) GetRebaseable() bool {
+	if p == nil || p.Rebaseable == nil {
+		return false
+	}
+	return *p.Rebaseable
+}
+
 // GetReviewComments returns the ReviewComments field if it's non-nil, zero value otherwise.
 func (p *PullRequest) GetReviewComments() int {
 	if p == nil || p.ReviewComments == nil {
diff --git a/github/pulls.go b/github/pulls.go
index a06f97bc..e022692d 100644
--- a/github/pulls.go
+++ b/github/pulls.go
@@ -24,6 +24,7 @@ type PullRequest struct {
 	ID                  *int64     `json:"id,omitempty"`
 	Number              *int       `json:"number,omitempty"`
 	State               *string    `json:"state,omitempty"`
+	Locked              *bool      `json:"locked,omitempty"`
 	Title               *string    `json:"title,omitempty"`
 	Body                *string    `json:"body,omitempty"`
 	CreatedAt           *time.Time `json:"created_at,omitempty"`
@@ -38,6 +39,7 @@ type PullRequest struct {
 	MergeableState      *string    `json:"mergeable_state,omitempty"`
 	MergedBy            *User      `json:"merged_by,omitempty"`
 	MergeCommitSHA      *string    `json:"merge_commit_sha,omitempty"`
+	Rebaseable          *bool      `json:"rebaseable,omitempty"`
 	Comments            *int       `json:"comments,omitempty"`
 	Commits             *int       `json:"commits,omitempty"`
 	Additions           *int       `json:"additions,omitempty"`


Test patch:
diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go
index 2e7b285e..22e1aafb 100644
--- a/github/github-stringify_test.go
+++ b/github/github-stringify_test.go
@@ -899,6 +899,7 @@ func TestPullRequest_String(t *testing.T) {
 		ID:                  Int64(0),
 		Number:              Int(0),
 		State:               String(""),
+		Locked:              Bool(false),
 		Title:               String(""),
 		Body:                String(""),
 		User:                &User{},
@@ -908,6 +909,7 @@ func TestPullRequest_String(t *testing.T) {
 		MergeableState:      String(""),
 		MergedBy:            &User{},
 		MergeCommitSHA:      String(""),
+		Rebaseable:          Bool(false),
 		Comments:            Int(0),
 		Commits:             Int(0),
 		Additions:           Int(0),
@@ -934,7 +936,7 @@ func TestPullRequest_String(t *testing.T) {
 		Base:                &PullRequestBranch{},
 		ActiveLockReason:    String(""),
 	}
-	want := `github.PullRequest{ID:0, Number:0, State:"", Title:"", Body:"", User:github.User{}, Draft:false, Merged:false, Mergeable:false, MergeableState:"", MergedBy:github.User{}, MergeCommitSHA:"", Comments:0, Commits:0, Additions:0, Deletions:0, ChangedFiles:0, URL:"", HTMLURL:"", IssueURL:"", StatusesURL:"", DiffURL:"", PatchURL:"", CommitsURL:"", CommentsURL:"", ReviewCommentsURL:"", ReviewCommentURL:"", ReviewComments:0, Assignee:github.User{}, Milestone:github.Milestone{}, MaintainerCanModify:false, AuthorAssociation:"", NodeID:"", Links:github.PRLinks{}, Head:github.PullRequestBranch{}, Base:github.PullRequestBranch{}, ActiveLockReason:""}`
+	want := `github.PullRequest{ID:0, Number:0, State:"", Locked:false, Title:"", Body:"", User:github.User{}, Draft:false, Merged:false, Mergeable:false, MergeableState:"", MergedBy:github.User{}, MergeCommitSHA:"", Rebaseable:false, Comments:0, Commits:0, Additions:0, Deletions:0, ChangedFiles:0, URL:"", HTMLURL:"", IssueURL:"", StatusesURL:"", DiffURL:"", PatchURL:"", CommitsURL:"", CommentsURL:"", ReviewCommentsURL:"", ReviewCommentURL:"", ReviewComments:0, Assignee:github.User{}, Milestone:github.Milestone{}, MaintainerCanModify:false, AuthorAssociation:"", NodeID:"", Links:github.PRLinks{}, Head:github.PullRequestBranch{}, Base:github.PullRequestBranch{}, ActiveLockReason:""}`
 	if got := v.String(); got != want {
 		t.Errorf("PullRequest.String = %v, want %v", got, want)
 	}