From baf0bb65a95a214047a34424de4c9b102886d5d3 Mon Sep 17 00:00:00 2001
From: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Date: Mon, 9 Oct 2023 07:32:45 -0600
Subject: [PATCH] Make broken branch notification less obnoxious (#34452)

---
 .github/workflows/rerun-workflows.yml | 41 ++++-----------------------
 1 file changed, 5 insertions(+), 36 deletions(-)

diff --git a/.github/workflows/rerun-workflows.yml b/.github/workflows/rerun-workflows.yml
index d93ba230cb2..fb5ac600ed5 100644
--- a/.github/workflows/rerun-workflows.yml
+++ b/.github/workflows/rerun-workflows.yml
@@ -27,7 +27,7 @@ jobs:
       - name: Trigger a re-run
         uses: actions/github-script@v6
         with:
-          script: |
+          script: | # js
             const MAX_ATTEMPTS = 2;
             const ATTEMPT = "${{ github.event.workflow_run.run_attempt }}";
             const BRANCH = "${{ github.event.workflow_run.head_branch }}";
@@ -49,58 +49,27 @@ jobs:
 
               await slack.chat.postMessage({
                 channel: 'engineering-ci',
+                text: 'Failing tests',
                 blocks: [
                   {
                     "type": "header",
                     "text": {
                       "type": "plain_text",
-                      "text": `:alert: CI is failing on ${BRANCH} :alert:`,
+                      "text": `:warning: CI is failing on ${BRANCH}`,
                       "emoji": true,
                     }
                   },
                 ],
                 attachments: [{
-                  color: '#f85149',
+                  color: BRANCH === 'master' ? '#f85149' : "#ffce33",
                   blocks: [
                     {
                       "type": "section",
                       "text": {
                         "type": "mrkdwn",
-                        "text": `Commit <https://github.com/metabase/metabase/commit/${BREAKING_COMMIT}|${BREAKING_COMMIT.slice(0,7)}> by ${AUTHOR} has failing <${FAILED_RUN_URL}|${FAILED_RUN_NAME}> tests on the \`${BRANCH}\` branch . :sad-panda:\nPlease fix ASAP. \n\nEmoji this message when it's fixed.`
+                        "text": `Commit <https://github.com/metabase/metabase/commit/${BREAKING_COMMIT}|${BREAKING_COMMIT.slice(0,7)}> by ${AUTHOR} has failing <${FAILED_RUN_URL}|${FAILED_RUN_NAME}> tests on the <https://github.com/metabase/metabase/commits/${BRANCH}|\`${BRANCH}\`> branch. :sad-panda:`
                       }
                     },
-                    {
-                      "type": "actions",
-                      "elements": [
-                        {
-                          "type": "button",
-                          "text": {
-                            "type": "plain_text",
-                            "text": "Failing Commit",
-                            "emoji": true
-                          },
-                          "url": `https://github.com/metabase/metabase/commit/${BREAKING_COMMIT}`
-                        },
-                        {
-                          "type": "button",
-                          "text": {
-                            "type": "plain_text",
-                            "text": `Recent commits to ${BRANCH}`,
-                            "emoji": true
-                          },
-                          "url": `https://github.com/metabase/metabase/commits/${BRANCH}`
-                        },
-                        {
-                          "type": "button",
-                          "text": {
-                            "type": "plain_text",
-                            "text": "Failed CI Run",
-                            "emoji": true
-                          },
-                          "url": `${FAILED_RUN_URL}`
-                        }
-                      ]
-                    }
                   ]
                 }]
               });
-- 
GitLab