Skip to content

Commit 6961c46

Browse files
committed
create review comment reply from GHPullRequest
1 parent 892d305 commit 6961c46

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

src/main/java/org/kohsuke/github/GHPullRequest.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected String getApiRoute() {
9090
public URL getPatchUrl() {
9191
return GitHub.parseURL(patch_url);
9292
}
93-
93+
9494
/**
9595
* The URL of the patch file.
9696
* like https://github.com/jenkinsci/jenkins/pull/100.patch
@@ -113,7 +113,7 @@ public GHCommitPointer getBase() {
113113
public GHCommitPointer getHead() {
114114
return head;
115115
}
116-
116+
117117
@Deprecated
118118
public Date getIssueUpdatedAt() throws IOException {
119119
return super.getUpdatedAt();
@@ -328,6 +328,17 @@ public GHPullRequestReviewComment createReviewComment(String body, String sha, S
328328
.to(getApiRoute() + "/comments", GHPullRequestReviewComment.class).wrapUp(this);
329329
}
330330

331+
/**
332+
* Create a reply to the current comment.
333+
*/
334+
public GHPullRequestReviewComment createReviewCommentReply(GHPullRequestReviewComment comment, String body) throws IOException {
335+
return new Requester(owner.root).method("POST")
336+
.with("body", body)
337+
.with("in_reply_to", comment.getId())
338+
.to(getApiRoute() + "/comments", GHPullRequestReviewComment.class)
339+
.wrapUp(this);
340+
}
341+
331342
/**
332343
* Merge this pull request.
333344
*

src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
4444
private String path;
4545
private int position = -1;
4646
private int original_position = -1;
47+
private long in_reply_to_id = -1L;
48+
4749

4850
public static GHPullRequestReviewComment draft(String body, String path, int position) {
4951
GHPullRequestReviewComment result = new GHPullRequestReviewComment();
@@ -89,10 +91,15 @@ public Integer getPosition() {
8991
}
9092

9193
@CheckForNull
92-
public int getOriginalPosition() {
94+
public Integer getOriginalPosition() {
9395
return original_position == -1 ? null : original_position;
9496
}
9597

98+
@CheckForNull
99+
public Long getInReplyToId() {
100+
return in_reply_to_id == -1 ? null : in_reply_to_id;
101+
}
102+
96103
@Override
97104
public URL getHtmlUrl() {
98105
return null;
@@ -129,7 +136,7 @@ public GHReaction createReaction(ReactionContent content) throws IOException {
129136
public PagedIterable<GHReaction> listReactions() {
130137
return new PagedIterable<GHReaction>() {
131138
public PagedIterator<GHReaction> _iterator(int pageSize) {
132-
return new PagedIterator<GHReaction>(owner.root.retrieve().withPreview(SQUIRREL_GIRL).asIterator(getApiRoute()+"/reactions", GHReaction[].class, pageSize)) {
139+
return new PagedIterator<GHReaction>(owner.root.retrieve().withPreview(SQUIRREL_GIRL).asIterator(getApiRoute() + "/reactions", GHReaction[].class, pageSize)) {
133140
@Override
134141
protected void wrapUp(GHReaction[] page) {
135142
for (GHReaction c : page)

0 commit comments

Comments
 (0)