From e37dd850156c90ccb48d12627948327b8a1afb78 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Fri, 13 May 2022 18:35:15 +0200 Subject: [PATCH 1/4] add PR title to push CI report --- .github/workflows/self-push.yml | 1 + utils/notification_service.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/self-push.yml b/.github/workflows/self-push.yml index 3321fcb6b2b5..997872c71500 100644 --- a/.github/workflows/self-push.yml +++ b/.github/workflows/self-push.yml @@ -312,6 +312,7 @@ 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.commits[0].message # 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..537cc993224a 100644 --- a/utils/notification_service.py +++ b/utils/notification_service.py @@ -724,7 +724,13 @@ 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") + if ci_title is not None: + title = f"🤗 Results of the {ci_event} tests: {ci_title}." + + message = Message(title, model_results, additional_results) message.post() message.post_reply() From ab029baa5d3f224287446a0397fba7d82ecbb491 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Fri, 13 May 2022 18:55:13 +0200 Subject: [PATCH 2/4] fix --- .github/workflows/self-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/self-push.yml b/.github/workflows/self-push.yml index 997872c71500..e79f353504a2 100644 --- a/.github/workflows/self-push.yml +++ b/.github/workflows/self-push.yml @@ -312,7 +312,7 @@ 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.commits[0].message + CI_TITLE: ${{ github.event.commits[0].message }} # 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: | From fed14779a2eb7bc8a3e712fe5c56ab04e9765a63 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Fri, 13 May 2022 19:17:58 +0200 Subject: [PATCH 3/4] fix --- .github/workflows/self-push.yml | 2 +- utils/notification_service.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/self-push.yml b/.github/workflows/self-push.yml index e79f353504a2..f54b25c46df7 100644 --- a/.github/workflows/self-push.yml +++ b/.github/workflows/self-push.yml @@ -312,7 +312,7 @@ 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.commits[0].message }} + CI_TITLE: ${{ github.event.head_commit.message }} # 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 537cc993224a..cb609ce88b17 100644 --- a/utils/notification_service.py +++ b/utils/notification_service.py @@ -728,6 +728,7 @@ def add_path(self, path: str, gpu: str = None): # Add PR title with a link for push CI ci_title = os.environ.get("CI_TITLE") if ci_title is not None: + ci_title = ci_title.strip().split("\n")[0].strip() title = f"🤗 Results of the {ci_event} tests: {ci_title}." message = Message(title, model_results, additional_results) From d32567432a1b53c33e1c25ebe262a1ae5c1b5e91 Mon Sep 17 00:00:00 2001 From: ydshieh Date: Fri, 13 May 2022 21:31:09 +0200 Subject: [PATCH 4/4] add link --- .github/workflows/self-push.yml | 1 + utils/notification_service.py | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/self-push.yml b/.github/workflows/self-push.yml index f54b25c46df7..e00844c953db 100644 --- a/.github/workflows/self-push.yml +++ b/.github/workflows/self-push.yml @@ -313,6 +313,7 @@ jobs: 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 cb609ce88b17..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) @@ -727,11 +735,15 @@ def add_path(self, path: str, gpu: str = None): 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() - title = f"🤗 Results of the {ci_event} tests: {ci_title}." + ci_title = f"<{commit_url}|{ci_title}>" + else: + ci_title = "" - message = Message(title, model_results, additional_results) + message = Message(title, ci_title, model_results, additional_results) message.post() message.post_reply()