Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -656,10 +656,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
</plugin>
<!--
This plugin is used to generate AOT metadata during tests so that it can be
compared against those in META-INF/native-image/org.kohsuke/github-api/*.
Expand Down Expand Up @@ -986,6 +982,18 @@
</plugins>
</build>
</profile>
<profile>
<id>artifactory-deploy</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.4</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
15 changes: 11 additions & 4 deletions src/main/java/org/kohsuke/github/GHIssueEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.IOException;
import java.time.Instant;
import java.util.Date;

Expand Down Expand Up @@ -169,8 +170,11 @@ public GHIssueRename getRename() {
* "https://docs.github.com/en/developers/webhooks-and-events/events/issue-event-types#review_request_removed">review_request_removed</a>
*/
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
public GHUser getRequestedReviewer() {
return this.requestedReviewer;
public GHUser getRequestedReviewer() throws IOException {
if (requestedReviewer != null) {
return root().getUser(requestedReviewer.getLogin());
}
return null;
}

/**
Expand All @@ -186,8 +190,11 @@ public GHUser getRequestedReviewer() {
* "https://docs.github.com/en/developers/webhooks-and-events/events/issue-event-types#review_request_removed">review_request_removed</a>
*/
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
public GHUser getReviewRequester() {
return this.reviewRequester;
public GHUser getReviewRequester() throws IOException {
if (reviewRequester != null) {
return root().getUser(reviewRequester.getLogin());
}
return null;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/kohsuke/github/GHPullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,8 @@ public URL getIssueUrl() {
* See <a href="https://developer.github.com/changes/2013-04-25-deprecating-merge-commit-sha">GitHub blog post</a>
*
* @return the merge commit sha
* @throws IOException
* the io exception
*/
public String getMergeCommitSha() throws IOException {
populate();
public String getMergeCommitSha() {
return mergeCommitSha;
}

Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -2579,6 +2579,17 @@ public PagedIterable<GHAutolink> listAutolinks() {
.toIterable(GHAutolink[].class, item -> item.lateBind(this));
}

/**
* List branches paged iterable.
*
* @return the paged iterable
*/
public PagedIterable<GHBranch> listBranches() {
return root().createRequest()
.withUrlPath(getApiTailUrl("branches"))
.toIterable(GHBranch[].class, item -> item.wrap(this));
}

/**
* List errors in the {@code CODEOWNERS} file. Note that GitHub skips lines with incorrect syntax; these are
* reported in the web interface, but not in the API call which this library uses.
Expand Down
17 changes: 12 additions & 5 deletions src/main/java/org/kohsuke/github/GitHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,9 @@ public GHUser getUser(String login) throws IOException {
if (u == null) {
u = createRequest().withUrlPath("/users/" + login).fetch(GHUser.class);
users.put(u.getLogin(), u);
if (!u.getLogin().equals(login)) {
users.put(login, u);
}
}
return u;
}
Expand Down Expand Up @@ -1325,11 +1328,15 @@ GitHubClient getClient() {
*/
GHUser intern(GHUser user) {
if (user != null) {
// if we already have this user in our map, get it
// if not, remember this new user
GHUser existingUser = users.putIfAbsent(user.getLogin(), user);
if (existingUser != null) {
user = existingUser;
try {
// if we already have this user in our map, get it
// if not, remember this new user
GHUser existingUser = users.putIfAbsent(user.getLogin(), getUser(user.getLogin()));
if (existingUser != null) {
user = existingUser;
}
} catch (IOException e) {
throw new GHException("Failed to get user", e);
}
}
return user;
Expand Down