From 2123f624fbb616a3794f5d8b7489612da89d7b0e Mon Sep 17 00:00:00 2001
From: "arnaud.b" <arnaud@adikteev.com>
Date: Wed, 13 Sep 2023 15:03:43 +0200
Subject: [PATCH] auto selection of slack channel if not provided: prod channel
 if env is production, engineering-deployed otherwise

---
 .github/workflows/slack-notif.yml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/slack-notif.yml b/.github/workflows/slack-notif.yml
index ac96c8d..e0ad99d 100644
--- a/.github/workflows/slack-notif.yml
+++ b/.github/workflows/slack-notif.yml
@@ -11,7 +11,6 @@ on:
         required: true
         type: string
       channel-id:
-        required: true
         type: string
       tag:
         required: true
@@ -32,7 +31,7 @@ jobs:
         id: slack
         uses: slackapi/slack-github-action@v1.24.0
         with:
-          channel-id: ${{ inputs.channel-id }}
+          channel-id: ${{ inputs.channel-id || (contains(inputs.environment, 'production') && 'C05P09PFTQU') || 'C56QR2WG6' }}
           payload: |
             {
               "text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
@@ -72,4 +71,4 @@ jobs:
             ]
             }
         env:
-          SLACK_BOT_TOKEN: ${{ secrets.botToken }}
\ No newline at end of file
+          SLACK_BOT_TOKEN: ${{ secrets.botToken }}