Skip to content

Commit

Permalink
Added slack webhook url
Browse files Browse the repository at this point in the history
  • Loading branch information
sangeet-joy_xero committed Oct 17, 2024
1 parent 37bbe4a commit 19c3d77
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 33 deletions.
69 changes: 36 additions & 33 deletions .github/actions/notify-slack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ inputs:
job_status:
required: true
description: "status of the job"
XERO_SLACK_WEBHOOK_URL:
required: true
description: "webhook url for channel - public-sdk-events"

runs:
using: "composite"
Expand All @@ -25,36 +28,36 @@ runs:
echo ${{github.repository}}
echo ${{github.sha}}
# - 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 Status",
# "value": "${{inputs.job_status}}"
# "short": true
# },
# {
# "title": "commit",
# "value": "${{github.sha}}"
# "short": true
# },
# ]
# }
# ]
# }
- name: Send slack notification
id: slack
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{inputs.XERO_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 Status",
"value": "${{inputs.job_status}}"
"short": true
},
{
"title": "commit",
"value": "${{github.sha}}"
"short": true
},
]
}
]
}
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
heading_text: "Publish job has succeeded !"
alert_type: "good"
job_status: ${{job.status}}
XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}}

notify-slack-on-failure:
runs-on: ubuntu-latest
Expand All @@ -73,3 +74,4 @@ jobs:
heading_text: "Publish job has failed. Check the details here: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
alert_type: "danger"
job_status: ${{job.status}}
XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}}

0 comments on commit 19c3d77

Please sign in to comment.