Repository: google/go-github
Pull request #2833 (2023-07-18 13:28:23)

Support line comments on PRs
https://github.com/google/go-github/issues/2832

gmlewis: Please run `go generate ./...` and push (not force-push) the changes to this PR.
See CONTRIBUTING.md for details.
varmakarthik12: > Please run `go generate ./...` and push (not force-push) the changes to this PR. See CONTRIBUTING.md for details.

My Bad, This should be good now. LMK.
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/google/go-github/pull/2833?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#2833](https://app.codecov.io/gh/google/go-github/pull/2833?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (c23b77d) into [master](https://app.codecov.io/gh/google/go-github/commit/6c1dedd9664a2f1f260f1d4e3ebfa0e123ce7dd1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (6c1dedd) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##           master    #2833   +/-   ##
=======================================
  Coverage   98.06%   98.06%           
=======================================
  Files         137      137           
  Lines       12289    12289           
=======================================
  Hits        12051    12051           
  Misses        162      162           
  Partials       76       76           
```


| [Impacted Files](https://app.codecov.io/gh/google/go-github/pull/2833?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) | Coverage Δ | |
|---|---|---|
| [github/pulls\_comments.go](https://app.codecov.io/gh/google/go-github/pull/2833?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL3B1bGxzX2NvbW1lbnRzLmdv) | `100.00% <ø> (ø)` | |



Patch:
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 1be9493a..43bb7d0c 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -15150,6 +15150,14 @@ func (p *PullRequestComment) GetStartSide() string {
 	return *p.StartSide
 }
 
+// GetSubjectType returns the SubjectType field if it's non-nil, zero value otherwise.
+func (p *PullRequestComment) GetSubjectType() string {
+	if p == nil || p.SubjectType == nil {
+		return ""
+	}
+	return *p.SubjectType
+}
+
 // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise.
 func (p *PullRequestComment) GetUpdatedAt() Timestamp {
 	if p == nil || p.UpdatedAt == nil {
diff --git a/github/pulls_comments.go b/github/pulls_comments.go
index 1f6b726d..ea1cf45d 100644
--- a/github/pulls_comments.go
+++ b/github/pulls_comments.go
@@ -41,6 +41,8 @@ type PullRequestComment struct {
 	URL               *string `json:"url,omitempty"`
 	HTMLURL           *string `json:"html_url,omitempty"`
 	PullRequestURL    *string `json:"pull_request_url,omitempty"`
+	// Can be one of: LINE, FILE from https://docs.github.com/en/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request
+	SubjectType *string `json:"subject_type,omitempty"`
 }
 
 func (p PullRequestComment) String() string {


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 2235cc5e..09c402ed 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -17669,6 +17669,16 @@ func TestPullRequestComment_GetStartSide(tt *testing.T) {
 	p.GetStartSide()
 }
 
+func TestPullRequestComment_GetSubjectType(tt *testing.T) {
+	var zeroValue string
+	p := &PullRequestComment{SubjectType: &zeroValue}
+	p.GetSubjectType()
+	p = &PullRequestComment{}
+	p.GetSubjectType()
+	p = nil
+	p.GetSubjectType()
+}
+
 func TestPullRequestComment_GetUpdatedAt(tt *testing.T) {
 	var zeroValue Timestamp
 	p := &PullRequestComment{UpdatedAt: &zeroValue}
diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go
index 8a78fb02..0ad7eefa 100644
--- a/github/github-stringify_test.go
+++ b/github/github-stringify_test.go
@@ -1312,8 +1312,9 @@ func TestPullRequestComment_String(t *testing.T) {
 		URL:                 String(""),
 		HTMLURL:             String(""),
 		PullRequestURL:      String(""),
+		SubjectType:         String(""),
 	}
-	want := `github.PullRequestComment{ID:0, NodeID:"", InReplyTo:0, Body:"", Path:"", DiffHunk:"", PullRequestReviewID:0, Position:0, OriginalPosition:0, StartLine:0, Line:0, OriginalLine:0, OriginalStartLine:0, Side:"", StartSide:"", CommitID:"", OriginalCommitID:"", User:github.User{}, Reactions:github.Reactions{}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, AuthorAssociation:"", URL:"", HTMLURL:"", PullRequestURL:""}`
+	want := `github.PullRequestComment{ID:0, NodeID:"", InReplyTo:0, Body:"", Path:"", DiffHunk:"", PullRequestReviewID:0, Position:0, OriginalPosition:0, StartLine:0, Line:0, OriginalLine:0, OriginalStartLine:0, Side:"", StartSide:"", CommitID:"", OriginalCommitID:"", User:github.User{}, Reactions:github.Reactions{}, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, AuthorAssociation:"", URL:"", HTMLURL:"", PullRequestURL:"", SubjectType:""}`
 	if got := v.String(); got != want {
 		t.Errorf("PullRequestComment.String = %v, want %v", got, want)
 	}