diff --git a/action.yml b/action.yml index 496a0a9..59502bd 100644 --- a/action.yml +++ b/action.yml @@ -13,6 +13,10 @@ inputs: channel: description: The Slack channel name for receiving the notification required: true + slack-ts: + description: The timestamp of the message to update + required: false + default: '' status: description: Customize the notification status to be "success", "failure" or a custom value. required: false @@ -68,44 +72,51 @@ runs: - name: Send notification if: always() - uses: slackapi/slack-github-action@v1.25.0 - env: - SLACK_BOT_TOKEN: ${{ inputs.token }} + uses: archive/github-actions-slack@v2.9.0 with: - channel-id: ${{ inputs.channel }} - payload: | - { - "text": ":${{ steps.fields.outputs.emoji }}: *Workflow ${{ inputs.status }}*", - "attachments": [ - { - "color": "${{ steps.fields.outputs.color }}", - "fields": [ - { - "title": "Repository", - "value": "", - "short": true - }, - { - "title": "Environment/Branch", - "value": "${{ inputs.environment || github.ref_name }}", - "short": true - }, - { - "title": "Author", - "value": "", - "short": true - }, - { - "title": "Job", - "value": "${{ github.job }}", - "short": true - }, - { - "title": "Commit Message", - "value": ${{ toJSON(steps.fields.outputs.message) }}, - "short": false - } - ] + slack-channel: ${{ inputs.channel }} + slack-bot-user-oauth-access-token: ${{ inputs.token }} + slack-optional-thread_ts: ${{ inputs.slack-ts }} + slack-blocks: >- + [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ":${{ steps.fields.outputs.emoji }}: *Workflow ${{ inputs.status }}*" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Repository*\n" + }, + { + "type": "mrkdwn", + "text": "*Environment/Branch*\n${{ inputs.environment || github.ref_name }}" + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Author*\n" + }, + { + "type": "mrkdwn", + "text": "*Job*\n${{ github.job }}" + } + ] + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Commit Message*\n${{ toJSON(steps.fields.outputs.message) }}" } - ] - } + } + ]