-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sangeet-joy_xero
committed
Oct 21, 2024
1 parent
2dced9d
commit 404f869
Showing
2 changed files
with
188 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: slack-alert-action | ||
description: "Action to send slack payload to public-sdk-events channel" | ||
|
||
inputs: | ||
heading_text: | ||
required: true | ||
description: "Heading of the slack payload" | ||
alert_type: | ||
required: true | ||
description: "type of the slack alert" | ||
job_status: | ||
required: true | ||
description: "status of the job" | ||
XERO_SLACK_WEBHOOK_URL: | ||
required: true | ||
description: "webhook url for channel - public-sdk-events" | ||
job_url: | ||
required: true | ||
description: "job run id link" | ||
button_type: | ||
required: true | ||
description: "color for the check logs button" | ||
package_version: | ||
required: true | ||
description: "released package version" | ||
repo_link: | ||
required: true | ||
description: "link of the repo" | ||
|
||
|
||
runs: | ||
using: "composite" | ||
|
||
steps: | ||
|
||
- name: Send slack notification | ||
id: slack | ||
uses: slackapi/[email protected] | ||
env: | ||
SLACK_WEBHOOK_URL: ${{inputs.XERO_SLACK_WEBHOOK_URL}} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
with: | ||
payload: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"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": "divider" | ||
}, | ||
{ | ||
"type": "section", | ||
"fields": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Repository:* \n ${{inputs.repo_link}}" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Status:*\n ${{inputs.job_status}}" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Package Version:*\n ${{inputs.package_version}}" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "actions", | ||
"elements": [ | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "Check the logs", | ||
"emoji": true | ||
}, | ||
"style": "${{inputs.button_type}}", | ||
"url": "${{inputs.job_url}}" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters