Skip to content

Commit

Permalink
added slack alert composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
sangeet-joy_xero committed Oct 16, 2024
1 parent 33559c3 commit 719f718
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 4 deletions.
46 changes: 46 additions & 0 deletions .github/actions/notify-slack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: slack-alert-action
description: "Action to send slack payload to public-sdk-events channel"

inputs:
heading_text:
required: true
alert_type:
required: true

runs:
using: "composite"

steps:
- name: Send slack notification
id: slack
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ""
with:
payload: |
{
"channel": "#public-sdk-events",
"text": ${{inputs.heading_text}}
"attachments": [
{
"color": ${{inputs.alert_type}},
"fields": [
{
"title": "Repository",
"value": "${{github.repository}}"
"short": true
},
{
"title": "Job",
"value": ""
"short": true
},
{
"title": "commit",
"value": "${{github.sha}}"
"short": true
},
]
}
]
}
12 changes: 8 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,18 @@ jobs:
run: npm publish
working-directory: xero-node

notify-slack:
notify-slack-on-success:
runs-on: ubuntu-latest
needs: publish
if: success()
steps:
- name: Send slack notification on sucess
if: success()
- name: Send slack notification on success
run: echo "Slack alert on success"

notify-slack-on-failure:
runs-on: ubuntu-latest
needs: publish
if: failure()
steps:
- name: Send slack notification on failure
if: failure()
run: echo "Slack alert on failure"

0 comments on commit 719f718

Please sign in to comment.