Skip to content

Commit

Permalink
Merge pull request #134 from deriv-com/test-shared-slack-workflow
Browse files Browse the repository at this point in the history
ci: created slack notification action
  • Loading branch information
niloofar-deriv authored Mar 25, 2024
2 parents 0a58fa9 + 267136c commit a0282d7
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 18 deletions.
34 changes: 34 additions & 0 deletions .github/actions/send_slack_notification/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: send_slack_notification
description: Send custom JSON data to Slack workflow
inputs:
SLACK_WEBHOOK_URL:
description: 'Slack webhook URL'
required: true
MESSAGE:
description: 'Status message'
required: true

runs:
using: composite
steps:
- name: Send custom JSON data to Slack workflow
env:
SLACK_WEBHOOK_URL: ${{ inputs.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
MESSAGE: ${{ inputs.MESSAGE }}

uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
with:
# For posting a rich message using Block Kit
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ env.MESSAGE }}
}
}
]
}
30 changes: 12 additions & 18 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,17 @@ jobs:
https://api.github.com/repos/${{github.repository}}/actions/workflows/$QUILL_ICONS_PARK_WORK_FLOW_FILE/dispatches \
-d '{"ref":"main"}'
- name: Send Release Slack notification
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
- name: Create Slack Message
id: create_slack_message
run: |
if [ $WORKFLOW_CONCLUSION == "success" ]; then
echo "MESSAGE=$RELEASE_TYPE ✅ The release for @deriv/quill-icons was successful, and the new version (${{ steps.extract_version.outputs.RELEASE_VERSION }}) is now available." >> $GITHUB_OUTPUT
else
echo "MESSAGE=$RELEASE_TYPE 🤨 The release attempt for @deriv/quill-icons with version ${{ steps.extract_version.outputs.RELEASE_VERSION }} was unsuccessful." >> $GITHUB_OUTPUT
fi
- name: Send Slack Notification
uses: './.github/actions/send_slack_notifications'
with:
# For posting a rich message using Block Kit
payload: |
{
"text": "@deriv/quill-icons",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@deriv/quill-icons@v${{ steps.extract_version.outputs.RELEASE_VERSION }} release: ${{ job.status }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
MESSAGE: ${{ steps.create_slack_message.outputs.MESSAGE }}

0 comments on commit a0282d7

Please sign in to comment.