Skip to content

Commit

Permalink
update slack failure notification checks
Browse files Browse the repository at this point in the history
  • Loading branch information
AafAnsari committed Nov 23, 2023
1 parent 69596c5 commit d4e7cdc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/terraform-member-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down Expand Up @@ -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: |
Expand Down

0 comments on commit d4e7cdc

Please sign in to comment.