From 9d8a0d96464eb14cda03dfbd06657b15c706cfd4 Mon Sep 17 00:00:00 2001 From: Tu Pham Date: Thu, 7 Mar 2024 10:30:37 -0500 Subject: [PATCH] Add slack notification action --- notify-slack/action.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 notify-slack/action.yml diff --git a/notify-slack/action.yml b/notify-slack/action.yml new file mode 100644 index 0000000..44f15bf --- /dev/null +++ b/notify-slack/action.yml @@ -0,0 +1,41 @@ +name: 'Slack Notification' +description: 'Send notifications to Slack' +inputs: + slack-webhook: + description: 'Slack webhook URL' + required: true + slack-username: + description: 'Username to display in the message' + required: true + slack-channel: + description: 'Slack channel to post the message' + required: true + title: + description: 'Message title' + required: true + text: + description: 'Message text' + required: true + color: + description: 'Color of the message' + required: false + default: 'Good' + +runs: + using: composite + steps: + - name: Notify Slack Channel + shell: bash + run: | + curl "${{ inputs.slack-webhook }}" "-XPOST -H 'Content-Type: application/json'" + --data '{ + "username": "${{ inputs.slack-username }}", + "channel": "${{ inputs.slack-channel }}", + "attachments": [ + { + "title": "${{ inputs.title }}", + "text": "${{ inputs.text }}", + "color": "${{ inputs.color }}" + } + ] + }'