Skip to content

Commit

Permalink
updated the payload
Browse files Browse the repository at this point in the history
  • Loading branch information
sangeet-joy_xero committed Oct 18, 2024
1 parent 1e9744d commit 6e1cacd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 42 deletions.
70 changes: 35 additions & 35 deletions .github/actions/notify-slack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ inputs:
job_url:
required: false
description: "job event link"
repository_name:
required: false
description: "repo name"
bot_token:
required: false
description: "slack app token"
channel_id:
required: false
description: "channel id"
button_type:
required: false
description: "color for the logs button"


runs:
Expand All @@ -47,32 +41,46 @@ runs:
env:
SLACK_WEBHOOK_URL: ${{inputs.XERO_SLACK_WEBHOOK_URL}}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
# SLACK_BOT_TOKEN: ${{inputs.bot_token}}
with:
# channel-id: ${{inputs.channel_id}}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "**${{inputs.heading_text}}**"
}
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "${{inputs.heading_text}}",
"style": {
"bold": true
}
},
{
"type": "emoji",
"name": "${{inputs.alert_type}}"
}
]
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Job status: **${{ job.status }}**"
}
"type": "divider"
},
{
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "PR: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
"fields": [
{
"type": "mrkdwn",
"text": "*Repository:* \n ${{github.server_url}}/${{github.repository}}"
},
{
"type": "mrkdwn",
"text": "*Status:*\n ${{inputs.job_status}}"
}
]
},
{
"type": "actions",
Expand All @@ -84,16 +92,8 @@ runs:
"text": "Check the logs",
"emoji": true
},
"style": "${{inputs.button_type}}",
"url": "${{inputs.job_url}}"
},
{
"type": "button",
"text": {
"type": "plain_text",
"text": "github repo: ${{github.event.repository.name}}",
"emoji": true
},
"url": "${{github.server_url}}/${{github.repository}}"
}
]
}
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ jobs:
uses: ./xero-node/.github/actions/notify-slack
with:
heading_text: "Publish job has succeeded !"
alert_type: "good"
alert_type: "thumbsup"
job_status: ${{job.status}}
XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}}
job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
# bot_token: ${{secrets.XERO_SLACK_BOT_TOKEN}}
channel_id: 'C07S29J583U'
button_type: "primary"

notify-slack-on-failure:
runs-on: ubuntu-latest
Expand All @@ -75,10 +74,8 @@ jobs:
uses: ./xero-node/.github/actions/notify-slack
with:
heading_text: "Publish job has failed !"
alert_type: "danger"
alert_type: "alert"
job_status: ${{job.status}}
XERO_SLACK_WEBHOOK_URL: ${{secrets.XERO_SLACK_WEBHOOK_URL}}
job_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
repository_name: ${{github.repository}}
# bot_token: ${{secrets.SLACK_BOT_TOKEN}}
channel_id: 'C07S29J583U'
button_type: "danger"

0 comments on commit 6e1cacd

Please sign in to comment.