Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 372d5ff

Browse filesBrowse files
committed
Fixed a test regression
Presumably due to the behaviour change on GitHub API?
1 parent ebf39ea commit 372d5ff
Copy full SHA for 372d5ff

File tree

Expand file treeCollapse file tree

2 files changed

+17
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+17
-3
lines changed

‎src/main/java/org/kohsuke/github/GHIssue.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHIssue.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public GHIssueState getState() {
129129
return Enum.valueOf(GHIssueState.class, state.toUpperCase(Locale.ENGLISH));
130130
}
131131

132-
public Collection<Label> getLabels() {
132+
public Collection<Label> getLabels() throws IOException {
133133
if(labels == null){
134134
return Collections.EMPTY_LIST;
135135
}

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

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHPullRequest.java
+16-2Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ public class GHPullRequest extends GHIssue {
5252
private String mergeable_state;
5353
private int changed_files;
5454

55+
/**
56+
* GitHub doesn't return some properties of {@link GHIssue} when requesting the GET on the 'pulls' API
57+
* route as opposed to 'issues' API route. This flag remembers whether we made the GET call on the 'issues' route
58+
* on this object to fill in those missing details
59+
*/
60+
private transient boolean fetchedIssueDetails;
61+
5562

5663
GHPullRequest wrapUp(GHRepository owner) {
5764
this.wrap(owner);
@@ -120,11 +127,12 @@ public Date getMergedAt() {
120127
}
121128

122129
@Override
123-
public Collection<Label> getLabels() {
130+
public Collection<Label> getLabels() throws IOException {
131+
fetchIssue();
124132
return super.getLabels();
125133
}
126134

127-
@Override
135+
@Override
128136
public GHUser getClosedBy() {
129137
return null;
130138
}
@@ -218,4 +226,10 @@ public void merge(String msg) throws IOException {
218226
new Requester(root).method("PUT").with("commit_message",msg).to(getApiRoute()+"/merge");
219227
}
220228

229+
private void fetchIssue() throws IOException {
230+
if (!fetchedIssueDetails) {
231+
new Requester(root).to(getIssuesApiRoute(), this);
232+
fetchedIssueDetails = true;
233+
}
234+
}
221235
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.