File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/main/java/org/jenkinsci/plugins/github/webhook/subscriber Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,22 @@ protected void onEvent(final GHSubscriberEvent event) {
76
76
URL repoUrl = push .getRepository ().getUrl ();
77
77
final String pusherName = push .getPusher ().getName ();
78
78
LOGGER .info ("Received PushEvent for {} from {}" , repoUrl , event .getOrigin ());
79
- final GitHubRepositoryName changedRepository = GitHubRepositoryName .create (repoUrl .toExternalForm ());
79
+ GitHubRepositoryName fromEventRepository = GitHubRepositoryName .create (repoUrl .toExternalForm ());
80
+
81
+ if (fromEventRepository == null ) {
82
+ // On push event on github.com url === html_url
83
+ // this is not consistent with the API docs and with hosted repositories
84
+ // see https://goo.gl/c1qmY7
85
+ // let's retry with 'html_url'
86
+ URL htmlUrl = push .getRepository ().getHtmlUrl ();
87
+ fromEventRepository = GitHubRepositoryName .create (htmlUrl .toExternalForm ());
88
+ if (fromEventRepository != null ) {
89
+ LOGGER .debug ("PushEvent handling: 'html_url' field "
90
+ + "has been used to retrieve project information (instead of default 'url' field)" );
91
+ }
92
+ }
93
+
94
+ final GitHubRepositoryName changedRepository = fromEventRepository ;
80
95
81
96
if (changedRepository != null ) {
82
97
// run in high privilege to see all the projects anonymous users don't see.
You can’t perform that action at this time.
0 commit comments