diff --git a/.github/workflows/self-push.yml b/.github/workflows/self-push.yml index 3321fcb6b2b5..e00844c953db 100644 --- a/.github/workflows/self-push.yml +++ b/.github/workflows/self-push.yml @@ -312,6 +312,8 @@ jobs: CI_SLACK_CHANNEL_ID_DAILY: ${{ secrets.CI_SLACK_CHANNEL_ID_DAILY }} CI_SLACK_CHANNEL_DUMMY_TESTS: ${{ secrets.CI_SLACK_CHANNEL_DUMMY_TESTS }} CI_EVENT: push + CI_TITLE: ${{ github.event.head_commit.message }} + CI_COMMIT_URL: ${{ github.event.head_commit.url }} # We pass `needs.setup.outputs.matrix` as the argument. A processing in `notification_service.py` to change # `models/bert` to `models_bert` is required, as the artifact names use `_` instead of `/`. run: | diff --git a/utils/notification_service.py b/utils/notification_service.py index 628cc7604807..0ee8b28837ae 100644 --- a/utils/notification_service.py +++ b/utils/notification_service.py @@ -98,8 +98,9 @@ def dicts_to_sum(objects: Union[Dict[str, Dict], List[dict]]): class Message: - def __init__(self, title: str, model_results: Dict, additional_results: Dict): + def __init__(self, title: str, ci_title: str, model_results: Dict, additional_results: Dict): self.title = title + self.ci_title = ci_title # Failures and success of the modeling tests self.n_model_success = sum(r["success"] for r in model_results.values()) @@ -158,6 +159,10 @@ def time(self) -> str: def header(self) -> Dict: return {"type": "header", "text": {"type": "plain_text", "text": self.title}} + @property + def ci_title_section(self) -> Dict: + return {"type": "section", "text": {"type": "mrkdwn", "text": self.ci_title}} + @property def no_failures(self) -> Dict: return { @@ -346,6 +351,9 @@ def additional_failures(self) -> Dict: def payload(self) -> str: blocks = [self.header] + if self.ci_title: + blocks.append(self.ci_title_section) + if self.n_model_failures > 0 or self.n_additional_failures > 0: blocks.append(self.failures) @@ -724,7 +732,18 @@ def add_path(self, path: str, gpu: str = None): artifact_path["gpu"] ] += f"*{line}*\n_{stacktraces.pop(0)}_\n\n" - message = Message(f"🤗 Results of the {ci_event} tests.", model_results, additional_results) + title = f"🤗 Results of the {ci_event} tests." + # Add PR title with a link for push CI + ci_title = os.environ.get("CI_TITLE") + commit_url = os.environ.get("CI_COMMIT_URL") + if ci_title is not None: + assert commit_url is not None + ci_title = ci_title.strip().split("\n")[0].strip() + ci_title = f"<{commit_url}|{ci_title}>" + else: + ci_title = "" + + message = Message(title, ci_title, model_results, additional_results) message.post() message.post_reply()