diff --git a/.github/workflows/hq-smoke-tests.yml b/.github/workflows/hq-smoke-tests.yml index 7d2dbc75c..851f4c4f8 100644 --- a/.github/workflows/hq-smoke-tests.yml +++ b/.github/workflows/hq-smoke-tests.yml @@ -119,7 +119,6 @@ jobs: receivers = 'qa@dimagi.com, sameena.shaik@fissionlabs.com, pruthvi.gottimukkula@fissionlabs.com' } - let SLACK_WEBHOOK_URL = return { "subject": subject, @@ -205,7 +204,7 @@ jobs: - name: Post to Slack channel for Staging id: slack_staging uses: slackapi/slack-github-action@v1.23.0 - if: ${{(github.event.client_payload.environment == 'staging') && failure() }} + if: ${{(github.event_name != 'repository_dispatch' && github.event.client_payload.environment == 'production') || (github.event.client_payload.environment == 'staging') && failure() }} with: payload: | { diff --git a/.github/workflows/request_api.yml b/.github/workflows/request_api.yml index 7d845c62d..97f8a7ea7 100644 --- a/.github/workflows/request_api.yml +++ b/.github/workflows/request_api.yml @@ -93,10 +93,69 @@ jobs: attachments: /home/runner/work/dimagi-qa/dimagi-qa/report_api_${{ matrix.environment }}.html priority: normal - - name: Post to Slack channel on Failure - id: slack-api + + - name: Post to Slack channel for Prod + id: slack-api-prod uses: slackapi/slack-github-action@v1.23.0 - if: failure() + if: ${{ (github.event_name == 'repository_dispatch') && (github.event.client_payload.environment == 'production') && always() }} + with: + payload: | + { + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": " Hola 👋 \n*${{ github.workflow }}* were just triggered!" + } + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "*Environment: *\n ${{ matrix.environment }} \n" + }, + { + "type": "mrkdwn", + "text": " " + }, + { + "type": "mrkdwn", + "text": "*Status: *\n ${{ job.status }} :x:" + } + ] + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Here's the corresponding workflow execution :arrow_right::arrow_right:" + }, + "accessory": { + "type": "button", + "text": { + "type": "plain_text", + "text": "View on Github", + "emoji": true + }, + "value": "click_me_123", + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "action_id": "button-action", + "style": "danger" + } + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_PROD_RESULTS }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + + + - name: Post to Slack channel for Staging + id: slack-api-staging + uses: slackapi/slack-github-action@v1.23.0 + if: ${{(github.event_name != 'repository_dispatch' && github.event.client_payload.environment == 'production') || (github.event.client_payload.environment == 'staging') && failure() }} with: payload: | {