Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/self-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
23 changes: 21 additions & 2 deletions utils/notification_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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()