File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -115,15 +115,36 @@ $(function() {
115115 dataType : 'json' ,
116116 async : false ,
117117 success : function ( data ) {
118+ // Get status for the pull request
118119 $ . ajax ( {
119120 url : data . statuses_url ,
120121 dataType : 'json' ,
121122 async : false ,
122- success : function ( data ) {
123- if ( data . length > 0 ) {
124- build_state = data [ 0 ] . state ;
125- link_text += " build:" + build_state ;
123+ success : function ( statuses ) {
124+ let hasError = false ;
125+ let isBuilding = false ;
126+ let allSuccess = true ;
127+
128+ statuses . forEach ( status => {
129+ if ( status . state === "error" ) {
130+ hasError = true ;
131+ } else if ( status . state === "building" ) {
132+ isBuilding = true ;
133+ } else if ( status . state !== "success" ) {
134+ allSuccess = false ;
135+ }
136+ } ) ;
137+
138+ let overall_status ;
139+ if ( hasError ) {
140+ overall_status = "error" ;
141+ } else if ( isBuilding ) {
142+ overall_status = "building" ;
143+ } else if ( allSuccess ) {
144+ overall_status = "success" ;
126145 }
146+
147+ link_text += " build state: " + overall_status ;
127148 }
128149 } ) ;
129150 }
You can’t perform that action at this time.
0 commit comments