diff --git a/.github/workflows/slack-send-message.yml b/.github/workflows/slack-send-message.yml index 230afdd..0e12c1b 100644 --- a/.github/workflows/slack-send-message.yml +++ b/.github/workflows/slack-send-message.yml @@ -13,43 +13,31 @@ on: jobs: send: runs-on: ${{ vars.RUNNER_UBUNTU }} + env: + SLACK_CHANNEL: ${{ inputs.channel-or-user }} # sanitize user inputs steps: - name: Send message to Slack - uses: slackapi/slack-github-action@v1.27.0 + uses: slackapi/slack-github-action@v2.0.0 with: - channel-id: ${{ github.event.inputs.channel-or-user }} + errors: true + method: chat.postMessage + token: ${{ secrets.SLACK_BOT_TOKEN }} payload: | - { - "blocks": [ - { - "type": "header", - "text": { - "type": "plain_text", - "text": ":mega: This is a test from the ${{github.repository}} repository", - "emoji": true - } - }, - { - "type": "divider" - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "- available :heavy_check_mark: \n - Check packages published on :heavy_check_mark:" - } - }, - { - "type": "divider" - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "See the next steps :arrow_left:" - } - } - ] - } - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + channel: ${{ env.SLACK_CHANNEL }} + text: "This is a test from the ${{github.repository}} repository" + blocks: + - type: "header" + text: + type: "plain_text" + text: ":mega: This is a test from the ${{github.repository}} repository" + emoji: true + - type: "divider" + - type: "section" + text: + type: "mrkdwn" + text: "- available :heavy_check_mark: \n - Check packages published on :heavy_check_mark:" + - type: "divider" + - type: "section" + text: + type: "mrkdwn" + text: "See the next steps :arrow_left:"