diff --git a/.github/workflows/terraform-member-environment.yml b/.github/workflows/terraform-member-environment.yml index ac51b810a..aeec3bba0 100644 --- a/.github/workflows/terraform-member-environment.yml +++ b/.github/workflows/terraform-member-environment.yml @@ -56,7 +56,7 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - if: ${{ failure() }} + if: ${{ failure() }} && github.event.ref == 'refs/heads/main' outputs: directories: ${{ steps.directories.outputs.CHANGED_DIRECTORIES }} @@ -122,6 +122,15 @@ jobs: scripts/terraform-plan.sh $directory unset workspace done + - name: Slack failure notification + uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0 + with: + payload: | + {"blocks":[{"type": "section","text": {"type": "mrkdwn","text": ":no_entry: Failed GitHub Action:"}},{"type": "section","fields":[{"type": "mrkdwn","text": "*Workflow:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"},{"type": "mrkdwn","text": "*Job:*\n${{ github.job }}"},{"type": "mrkdwn","text": "*Repo:*\n${{ github.repository }}"}]}]} + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + if: ${{ failure() }} && github.event.ref == 'refs/heads/main' - name: Mark job skipped if: ${{ steps.workspace.outputs.skip_plan == 'true' }} run: |