@@ -55,43 +55,39 @@ def update_output(github, output: output_in_progress)
5555 end
5656
5757 def cancelled ( github , output : { } , agent : 'Github' )
58- return if cancelled?
58+ check_run = refresh_reference ( github )
59+ github . cancelled ( check_run . id , output )
5960
60- create_github_check ( github )
61- github . cancelled ( check_ref , output )
62- update ( status : :cancelled )
61+ update ( status : :cancelled , check_ref : check_run . id )
6362 AuditStatus . create ( auditable : self , status : :cancelled , agent : agent , created_at : Time . now )
6463 notification
6564 end
6665
6766 def failure ( github , output : { } , agent : 'Github' )
68- return if failure?
67+ check_run = refresh_reference ( github )
68+ github . failure ( check_run . id , output )
6969
70- create_github_check ( github )
71- github . failure ( check_ref , output )
72- update ( status : :failure )
70+ update ( status : :failure , check_ref : check_run . id )
7371 AuditStatus . create ( auditable : self , status : :failure , agent : agent , created_at : Time . now )
7472 notification
7573 end
7674
7775 def success ( github , output : { } , agent : 'Github' )
78- return if success?
76+ check_run = refresh_reference ( github )
77+ github . success ( check_run . id , output )
7978
80- create_github_check ( github )
81- github . success ( check_ref , output )
82- update ( status : :success )
79+ reload
80+ update ( status : :success , check_ref : check_run . id )
8381 AuditStatus . create ( auditable : self , status : :success , agent : agent , created_at : Time . now )
8482 notification
8583 end
8684
87- def refresh_reference ( github , agent : 'Github' )
88- check_run = github . create ( github_stage_full_name ( name ) )
89- update ( check_ref : check_run . id )
90- AuditStatus . create ( auditable : self , status : :refresh , agent : agent , created_at : Time . now )
91- end
92-
9385 private
9486
87+ def refresh_reference ( github )
88+ github . create ( github_stage_full_name ( name ) )
89+ end
90+
9591 def in_progress_notification
9692 SlackBot . instance . stage_in_progress_notification ( self )
9793 end
0 commit comments