Repository: google/go-github (go)

Issue:
Add support for CommitID, InReplyTo, and SubjectType to DraftReviewComment
Currently these fields are missing: https://docs.github.com/en/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request

Happy to raise a PR to add support

Pull request:
Add CommitID, InReplyTo, and SubjectType to DraftReviewComment
closes #3168 

Made InReplyTo an int64 following the established type in https://pkg.go.dev/github.com/google/go-github/v62/github#PullRequestComment but happy to change if that or anything else is incorrect.

Patch:
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 1580ab4b..fc6d787e 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -6510,6 +6510,22 @@ func (d *DraftReviewComment) GetBody() string {
 	return *d.Body
 }
 
+// GetCommitID returns the CommitID field if it's non-nil, zero value otherwise.
+func (d *DraftReviewComment) GetCommitID() string {
+	if d == nil || d.CommitID == nil {
+		return ""
+	}
+	return *d.CommitID
+}
+
+// GetInReplyTo returns the InReplyTo field if it's non-nil, zero value otherwise.
+func (d *DraftReviewComment) GetInReplyTo() int64 {
+	if d == nil || d.InReplyTo == nil {
+		return 0
+	}
+	return *d.InReplyTo
+}
+
 // GetLine returns the Line field if it's non-nil, zero value otherwise.
 func (d *DraftReviewComment) GetLine() int {
 	if d == nil || d.Line == nil {
@@ -6558,6 +6574,14 @@ func (d *DraftReviewComment) GetStartSide() string {
 	return *d.StartSide
 }
 
+// GetSubjectType returns the SubjectType field if it's non-nil, zero value otherwise.
+func (d *DraftReviewComment) GetSubjectType() string {
+	if d == nil || d.SubjectType == nil {
+		return ""
+	}
+	return *d.SubjectType
+}
+
 // GetRef returns the Ref field.
 func (e *EditBase) GetRef() *EditRef {
 	if e == nil {
diff --git a/github/pulls_reviews.go b/github/pulls_reviews.go
index 27b8dc37..28450c3d 100644
--- a/github/pulls_reviews.go
+++ b/github/pulls_reviews.go
@@ -35,9 +35,12 @@ func (p PullRequestReview) String() string {
 
 // DraftReviewComment represents a comment part of the review.
 type DraftReviewComment struct {
-	Path     *string `json:"path,omitempty"`
-	Position *int    `json:"position,omitempty"`
-	Body     *string `json:"body,omitempty"`
+	Path        *string `json:"path,omitempty"`
+	Position    *int    `json:"position,omitempty"`
+	Body        *string `json:"body,omitempty"`
+	CommitID    *string `json:"commit_id,omitempty"`
+	InReplyTo   *int64  `json:"in_reply_to,omitempty"`
+	SubjectType *string `json:"subject_type,omitempty"`
 
 	// The new comfort-fade-preview fields
 	StartSide *string `json:"start_side,omitempty"`


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 08f0e825..a15fb2ec 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -7613,6 +7613,26 @@ func TestDraftReviewComment_GetBody(tt *testing.T) {
 	d.GetBody()
 }
 
+func TestDraftReviewComment_GetCommitID(tt *testing.T) {
+	var zeroValue string
+	d := &DraftReviewComment{CommitID: &zeroValue}
+	d.GetCommitID()
+	d = &DraftReviewComment{}
+	d.GetCommitID()
+	d = nil
+	d.GetCommitID()
+}
+
+func TestDraftReviewComment_GetInReplyTo(tt *testing.T) {
+	var zeroValue int64
+	d := &DraftReviewComment{InReplyTo: &zeroValue}
+	d.GetInReplyTo()
+	d = &DraftReviewComment{}
+	d.GetInReplyTo()
+	d = nil
+	d.GetInReplyTo()
+}
+
 func TestDraftReviewComment_GetLine(tt *testing.T) {
 	var zeroValue int
 	d := &DraftReviewComment{Line: &zeroValue}
@@ -7673,6 +7693,16 @@ func TestDraftReviewComment_GetStartSide(tt *testing.T) {
 	d.GetStartSide()
 }
 
+func TestDraftReviewComment_GetSubjectType(tt *testing.T) {
+	var zeroValue string
+	d := &DraftReviewComment{SubjectType: &zeroValue}
+	d.GetSubjectType()
+	d = &DraftReviewComment{}
+	d.GetSubjectType()
+	d = nil
+	d.GetSubjectType()
+}
+
 func TestEditBase_GetRef(tt *testing.T) {
 	e := &EditBase{}
 	e.GetRef()
diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go
index 8633d837..c311889c 100644
--- a/github/github-stringify_test.go
+++ b/github/github-stringify_test.go
@@ -388,15 +388,18 @@ func TestDiscussionComment_String(t *testing.T) {
 
 func TestDraftReviewComment_String(t *testing.T) {
 	v := DraftReviewComment{
-		Path:      String(""),
-		Position:  Int(0),
-		Body:      String(""),
-		StartSide: String(""),
-		Side:      String(""),
-		StartLine: Int(0),
-		Line:      Int(0),
-	}
-	want := `github.DraftReviewComment{Path:"", Position:0, Body:"", StartSide:"", Side:"", StartLine:0, Line:0}`
+		Path:        String(""),
+		Position:    Int(0),
+		Body:        String(""),
+		CommitID:    String(""),
+		InReplyTo:   Int64(0),
+		SubjectType: String(""),
+		StartSide:   String(""),
+		Side:        String(""),
+		StartLine:   Int(0),
+		Line:        Int(0),
+	}
+	want := `github.DraftReviewComment{Path:"", Position:0, Body:"", CommitID:"", InReplyTo:0, SubjectType:"", StartSide:"", Side:"", StartLine:0, Line:0}`
 	if got := v.String(); got != want {
 		t.Errorf("DraftReviewComment.String = %v, want %v", got, want)
 	}