From 31c9bbd1a1be6875cbea2c4109d2f7ae096b1ee9 Mon Sep 17 00:00:00 2001 From: Mariana Souza Date: Thu, 28 Nov 2024 15:10:52 -0500 Subject: [PATCH] Add slack notification --- .github/workflows/ios-sdk-ci.yml | 58 ++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/.github/workflows/ios-sdk-ci.yml b/.github/workflows/ios-sdk-ci.yml index f1449c3..9dd6b46 100644 --- a/.github/workflows/ios-sdk-ci.yml +++ b/.github/workflows/ios-sdk-ci.yml @@ -83,3 +83,61 @@ jobs: with: name: build-log-objc path: /Users/runner/Library/Logs/gym + + slack-notification: + runs-on: ubuntu-22.04 + needs: [build-demo-swift, build-demo-objc] + permissions: + id-token: write + steps: + - name: Successful Release Post to Slack + uses: slackapi/slack-github-action@v2.0.0 + if: ${{ success() && (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) }} + with: + method: chat.postMessage + token: "${{ secrets.SLACK_MESSENGER_APP_TOKEN }}" + payload: | + channel: "${{ secrets.ALERTS_SLACK_CHANNEL_ID }}" + text: "iOS SDK release: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + blocks: + - type: "header" + text: + type: "plain_text" + text: ":certified: iOS SDK release" + emoji: true + - type: "section" + fields: + - type: "mrkdwn" + text: "*Status:*\n${{ job.status }}" + - type: "mrkdwn" + text: "*Branch:*\n${{ github.ref_name }}" + - type: "mrkdwn" + text: "*Author:*\n${{ github.actor || github.triggering_actor }}" + - type: "mrkdwn" + text: ":white_check_mark: *iOS SDK release:*\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + - name: Build failure Post to Slack + uses: slackapi/slack-github-action@v2.0.0 + if: ${{ failure() && github.event_name == 'pull_request' }} + with: + method: chat.postMessage + token: "${{ secrets.SLACK_MESSENGER_APP_TOKEN }}" + payload: | + channel: "${{ secrets.ALERTS_SLACK_CHANNEL_ID }}" + text: "iOS SDK release: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + blocks: + - type: "header" + text: + type: "plain_text" + text: ":certified: iOS SDK release" + emoji: true + - type: "section" + fields: + - type: "mrkdwn" + text: "*Status:*\n${{ job.status }}" + - type: "mrkdwn" + text: "*Branch:*\n${{ github.ref_name }}" + - type: "mrkdwn" + text: "*Author:*\n${{ github.actor || github.triggering_actor }}" + - type: "mrkdwn" + text: ":x: *iOS SDK release:*\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" +