Skip to content

Commit

Permalink
Bumping up to github-api 1.67
Browse files Browse the repository at this point in the history
 ... to deal with backward incompatible API change in github-api. The getUrl() method has changed in some of those methods to return API URL as opposed to HTML URL. This change fixes that.
  • Loading branch information
kohsuke committed Apr 14, 2015
1 parent 20fad8e commit 163acee
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>github-api</artifactId>
<version>1.59</version>
<version>1.67</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private void updateCommitStatus(@Nonnull AbstractBuild<?, ?> build, @Nonnull Bui
msg = Messages.CommitNotifier_Failed(build.getDisplayName(), duration);
}

listener.getLogger().println(Messages.GitHubCommitNotifier_SettingCommitStatus(repository.getUrl() + "/commit/" + sha1));
listener.getLogger().println(Messages.GitHubCommitNotifier_SettingCommitStatus(repository.getHtmlUrl() + "/commit/" + sha1));
repository.createCommitStatus(sha1, state, build.getAbsoluteUrl(), msg, build.getProject().getFullName());
}
}
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/com/cloudbees/jenkins/GitHubRepositoryName.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,9 @@ protected boolean filter(V v) {
* Does this repository match the repository referenced in the given {@link GHCommitPointer}?
*/
public boolean matches(GHCommitPointer commit) {
try {
return userName.equals(commit.getUser().getLogin())
&& repositoryName.equals(commit.getRepository().getName())
&& host.equals(new URL(commit.getRepository().getUrl()).getHost());
} catch (MalformedURLException e) {
return false;
}
return userName.equals(commit.getUser().getLogin())
&& repositoryName.equals(commit.getRepository().getName())
&& host.equals(commit.getRepository().getHtmlUrl().getHost());
}

/**
Expand All @@ -153,7 +149,7 @@ public boolean matches(GHCommitPointer commit) {
public boolean matches(GHRepository repo) throws IOException {
return userName.equals(repo.getOwner().getLogin()) // TODO: use getOwnerName
&& repositoryName.equals(repo.getName())
&& host.equals(new URL(repo.getUrl()).getHost());
&& host.equals(repo.getHtmlUrl().getHost());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen
final String sha1 = ObjectId.toString(BuildDataHelper.getCommitSHA1(build));
for (GitHubRepositoryName name : GitHubRepositoryNameContributor.parseAssociatedNames(build.getProject())) {
for (GHRepository repository : name.resolve()) {
listener.getLogger().println(Messages.GitHubCommitNotifier_SettingCommitStatus(repository.getUrl() + "/commit/" + sha1));
listener.getLogger().println(Messages.GitHubCommitNotifier_SettingCommitStatus(repository.getHtmlUrl() + "/commit/" + sha1));
repository.createCommitStatus(sha1, GHCommitState.PENDING, build.getAbsoluteUrl(), Messages.CommitNotifier_Pending(build.getDisplayName()), build.getProject().getFullName());
}
}
Expand Down

0 comments on commit 163acee

Please sign in to comment.