Skip to content

Commit

Permalink
Use block
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyCTHsu committed May 24, 2024
1 parent af6c0c8 commit c87294a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
21 changes: 20 additions & 1 deletion .github/actions/slack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,28 @@ inputs:
runs:
using: "composite"
steps:
# - id: prepare_payload
# run: |
# PAYLOAD="{\"blocks\": [{\"type\": \"section\", \"text\": {\"type\": \"mrkdwn\", \"text\": \"${{ inputs.message }}\"}}]}"
# echo "PAYLOAD=$PAYLOAD" >> $GITHUB_ENV
# shell: bash

- uses: slackapi/slack-github-action@v1.26.0
env:
SLACK_BOT_TOKEN: ${{ inputs.token }}
with:
channel-id: ${{ inputs.channel }}
slack-message: ${{ inputs.message }}
payload: "{\"blocks\": [{\"type\": \"section\", \"text\": {\"type\": \"mrkdwn\", \"text\": \"${{ inputs.message }}\"}}]}"
# slack-message: ${{ inputs.message }}
# payload: |
# {
# "blocks": [
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "${{ env.MESSAGE }}"
# }
# }
# ]
# }
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
name: Notify success
uses: ./.github/actions/slack
with:
message: |
message: |-
:github-check: [Test passed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!
${{ github.ref_type }}: ${{ github.ref_name }}
Commit SHA: ${{ github.sha }}
Expand All @@ -63,7 +63,7 @@ jobs:
uses: ./.github/actions/slack
name: Notify failure
with:
message: |
message: |-
:red-light: [Test failed](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})!
${{ github.ref_type }}: ${{ github.ref_name }}
Commit SHA: ${{ github.sha }}
Expand Down

0 comments on commit c87294a

Please sign in to comment.