Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,10 @@
LOGGER.warn("Received malformed PushEvent: " + event.getPayload(), e);
return;
}
URL repoUrl = push.getRepository().getUrl();
URL htmlUrl = push.getRepository().getHtmlUrl();
final String pusherName = push.getPusher().getName();
LOGGER.info("Received PushEvent for {} from {}", repoUrl, event.getOrigin());
GitHubRepositoryName fromEventRepository = GitHubRepositoryName.create(repoUrl.toExternalForm());

if (fromEventRepository == null) {
// On push event on github.com url === html_url
// this is not consistent with the API docs and with hosted repositories
// see https://goo.gl/c1qmY7
// let's retry with 'html_url'
URL htmlUrl = push.getRepository().getHtmlUrl();
fromEventRepository = GitHubRepositoryName.create(htmlUrl.toExternalForm());
if (fromEventRepository != null) {
LOGGER.debug("PushEvent handling: 'html_url' field "
+ "has been used to retrieve project information (instead of default 'url' field)");
}
}

final GitHubRepositoryName changedRepository = fromEventRepository;
LOGGER.info("Received PushEvent for {} from {}", htmlUrl, event.getOrigin());
final GitHubRepositoryName changedRepository = GitHubRepositoryName.create(htmlUrl.toExternalForm());

if (changedRepository != null) {
// run in high privilege to see all the projects anonymous users don't see.
Expand Down Expand Up @@ -128,7 +113,7 @@
}

} else {
LOGGER.warn("Malformed repo url {}", repoUrl);
LOGGER.warn("Malformed repo html url {}", htmlUrl);

Check warning on line 116 in src/main/java/org/jenkinsci/plugins/github/webhook/subscriber/DefaultPushGHEventSubscriber.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 116 is not covered by tests
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"html_url": "https://github.com/lanwen/test",
"description": "Personal blog",
"fork": false,
"url": "https://github.com/lanwen/test",
"url": "https://api.github.com/lanwen/test",
"forks_url": "https://api.github.com/repos/lanwen/test/forks",
"keys_url": "https://api.github.com/repos/lanwen/test/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/lanwen/test/collaborators{/collaborator}",
Expand Down