@@ -98,8 +98,9 @@ def dicts_to_sum(objects: Union[Dict[str, Dict], List[dict]]):
9898
9999
100100class Message :
101- def __init__ (self , title : str , model_results : Dict , additional_results : Dict ):
101+ def __init__ (self , title : str , ci_title : str , model_results : Dict , additional_results : Dict ):
102102 self .title = title
103+ self .ci_title = ci_title
103104
104105 # Failures and success of the modeling tests
105106 self .n_model_success = sum (r ["success" ] for r in model_results .values ())
@@ -158,6 +159,10 @@ def time(self) -> str:
158159 def header (self ) -> Dict :
159160 return {"type" : "header" , "text" : {"type" : "plain_text" , "text" : self .title }}
160161
162+ @property
163+ def ci_title_section (self ) -> Dict :
164+ return {"type" : "section" , "text" : {"type" : "mrkdwn" , "text" : self .ci_title }}
165+
161166 @property
162167 def no_failures (self ) -> Dict :
163168 return {
@@ -346,6 +351,9 @@ def additional_failures(self) -> Dict:
346351 def payload (self ) -> str :
347352 blocks = [self .header ]
348353
354+ if self .ci_title :
355+ blocks .append (self .ci_title_section )
356+
349357 if self .n_model_failures > 0 or self .n_additional_failures > 0 :
350358 blocks .append (self .failures )
351359
@@ -724,7 +732,18 @@ def add_path(self, path: str, gpu: str = None):
724732 artifact_path ["gpu" ]
725733 ] += f"*{ line } *\n _{ stacktraces .pop (0 )} _\n \n "
726734
727- message = Message (f"🤗 Results of the { ci_event } tests." , model_results , additional_results )
735+ title = f"🤗 Results of the { ci_event } tests."
736+ # Add PR title with a link for push CI
737+ ci_title = os .environ .get ("CI_TITLE" )
738+ commit_url = os .environ .get ("CI_COMMIT_URL" )
739+ if ci_title is not None :
740+ assert commit_url is not None
741+ ci_title = ci_title .strip ().split ("\n " )[0 ].strip ()
742+ ci_title = f"<{ commit_url } |{ ci_title } >"
743+ else :
744+ ci_title = ""
745+
746+ message = Message (title , ci_title , model_results , additional_results )
728747
729748 message .post ()
730749 message .post_reply ()
0 commit comments