Skip to content

Commit

Permalink
added the 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 719f718 commit 21d9a67
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 36 deletions.
70 changes: 37 additions & 33 deletions .github/actions/notify-slack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,40 @@ 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
},
]
}
]
}
- name: testing
run: |
echo ${{inputs.alert_type}}
echo ${{inputs.heading_text}}
# - 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: 9 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,18 @@ jobs:
if: success()
steps:
- name: Send slack notification on success
run: echo "Slack alert on success"
uses: ./xero-node/.github/actions/notify-slack
with:
heading_text: "Publish job has succeeded !"
alert_type: "good"

notify-slack-on-failure:
runs-on: ubuntu-latest
needs: publish
if: failure()
steps:
- name: Send slack notification on failure
run: echo "Slack alert on failure"
- name: Send slack notification
uses: ./xero-node/.github/actions/notify-slack
with:
heading_text: "Publish job has failed, Please check the logs"
alert_type: "danger"

0 comments on commit 21d9a67

Please sign in to comment.