Skip to content

chore(ci): update slack message #44

chore(ci): update slack message

chore(ci): update slack message #44

Workflow file for this run

name: CI
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
pull-requests: read
jobs:
setup-and-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install Dependencies
run: |
pnpm install --frozen-lockfile
- name: Commit lint
uses: wagoid/commitlint-github-action@v5
with:
failOnWarnings: true
- name: Run ESLint
run: pnpm lint
slack_notification:
name: Slack Notification
runs-on: ubuntu-latest
needs: setup-and-lint
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Success Notification
- name: Send Success Slack Notification
if: ${{ needs.setup-and-lint.result == 'success' }}
uses: ./slack-actions/workflow-notification
with:
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFY_PUBLIC_SHARED_ACTIONS }}
status: success
payload: |
{
"text": "Completely custom Slack message for CI",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"emoji": true,
"text": "CI Workflow Success"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Repository:*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>"
},
{
"type": "mrkdwn",
"text": "*Branch:*\n<${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}|${{ github.ref_name }}>"
},
{
"type": "mrkdwn",
"text": "*Workflow Run:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_number }}>"
},
{
"type": "mrkdwn",
"text": "*TriggeredByCommit:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ steps.slack-variables.outputs.short-commit-hash }}>"
},
{
"type": "mrkdwn",
"text": "*Triggered By:*\n${{ github.actor }}"
},
{
"type": "mrkdwn",
"text": "*Commit Author:*\n${{ github.event.head_commit.author.name }}"
},
{
"type": "mrkdwn",
"text": "*Event Name:*\n${{ github.event_name }}"
}
]
}
]
}
# Failure Notification
- name: Send Failure Slack alert
if: ${{ needs.setup-and-lint.result == 'failure' }}
uses: ./slack-actions/workflow-notification
with:
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_ALERT_PUBLIC_SHARED_ACTIONS }}
status: failure
payload: |
{
"text": "Completely custom Slack message for CI",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"emoji": true,
"text": "CI Workflow Failure"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Repository:*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>"
},
{
"type": "mrkdwn",
"text": "*Branch:*\n<${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }}|${{ github.ref_name }}>"
},
{
"type": "mrkdwn",
"text": "*Workflow Run:*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_number }}>"
},
{
"type": "mrkdwn",
"text": "*TriggeredByCommit:*\n<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ steps.slack-variables.outputs.short-commit-hash }}>"
},
{
"type": "mrkdwn",
"text": "*Triggered By:*\n${{ github.actor }}"
},
{
"type": "mrkdwn",
"text": "*Commit Author:*\n${{ github.event.head_commit.author.name }}"
},
{
"type": "mrkdwn",
"text": "*Event Name:*\n${{ github.event_name }}"
}
]
}
]
}