Skip to content

ci: send slack message when ci fails on main #108

ci: send slack message when ci fails on main

ci: send slack message when ci fails on main #108

name: Pull Request Integration
on:
pull_request:
branches:
- main
jobs:
test:
uses: ./.github/workflows/test.yaml
secrets: inherit
check_formatting:
uses: ./.github/workflows/check_formatting.yaml
notify-slack:
needs: test
if: failure()
runs-on: ubuntu-latest
steps:
- name: Send Slack Notification
uses: slackapi/slack-github-action@v2.1.1
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
text: "CI failed on ${{ github.ref_name }}" # fallback text
blocks:
- type: "section"
text:
type: "mrkdwn"
text: ":rotating_light: *CI FAILED on `${{ github.ref_name }}`*"
- type: "section"
fields:
- type: "mrkdwn"
text: "*Workflow:*\n`${{ github.workflow }}`"
- type: "mrkdwn"
text: "*Job:*\n`${{ github.job }}`"
- type: "mrkdwn"
text: "*Commit:*\n`${{ github.sha }}`"
- type: "mrkdwn"
text: "*Author:*\n`${{ github.actor }}`"
- type: "actions"
elements:
- type: "button"
text:
type: "plain_text"
text: "View run"
emoji: true
url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"