@@ -23,19 +23,7 @@ associated documentation files (the "Software"), to deal in the Software without
2323
2424package org .jenkinsci .plugins .gogs ;
2525
26- import hudson .Extension ;
27- import hudson .model .Job ;
28- import hudson .model .UnprotectedRootAction ;
29- import hudson .security .ACL ;
30- import hudson .util .Secret ;
31- import net .sf .json .JSONObject ;
32- import org .acegisecurity .context .SecurityContext ;
33- import org .acegisecurity .context .SecurityContextHolder ;
34- import org .apache .commons .codec .binary .Hex ;
35- import org .apache .commons .io .IOUtils ;
36- import org .apache .commons .lang .StringUtils ;
37- import org .kohsuke .stapler .StaplerRequest ;
38- import org .kohsuke .stapler .StaplerResponse ;
26+ import static com .google .common .base .Preconditions .checkNotNull ;
3927
4028import javax .crypto .Mac ;
4129import javax .crypto .spec .SecretKeySpec ;
@@ -50,7 +38,19 @@ associated documentation files (the "Software"), to deal in the Software without
5038import java .util .Map ;
5139import java .util .logging .Logger ;
5240
53- import static com .google .common .base .Preconditions .checkNotNull ;
41+ import hudson .Extension ;
42+ import hudson .model .Job ;
43+ import hudson .model .UnprotectedRootAction ;
44+ import hudson .security .ACL ;
45+ import hudson .util .Secret ;
46+ import net .sf .json .JSONObject ;
47+ import org .acegisecurity .context .SecurityContext ;
48+ import org .acegisecurity .context .SecurityContextHolder ;
49+ import org .apache .commons .codec .binary .Hex ;
50+ import org .apache .commons .io .IOUtils ;
51+ import org .apache .commons .lang .StringUtils ;
52+ import org .kohsuke .stapler .StaplerRequest ;
53+ import org .kohsuke .stapler .StaplerResponse ;
5454
5555/**
5656 * @author Alexander Verhaar
@@ -121,8 +121,8 @@ void internalDoIndex(GogsResults result, StaplerRequest req, StaplerResponse rsp
121121
122122 // Get X-Gogs-Event
123123 String event = req .getHeader ("X-Gogs-Event" );
124- if (!"push" .equals (event )) {
125- result .setStatus (403 , "Only push event can be accepted." );
124+ if (!"push" .equals (event ) && ! "release" . equals ( event ) ) {
125+ result .setStatus (403 , "Only push or release events are accepted." );
126126 exitWebHook (result , rsp );
127127 return ;
128128 }
0 commit comments