Skip to content

Commit

Permalink
Update payload file…
Browse files Browse the repository at this point in the history
  • Loading branch information
pingevt committed Sep 15, 2024
1 parent 4ad52e5 commit da60ee6
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 30 deletions.
35 changes: 7 additions & 28 deletions .github/workflows/testing-slack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,6 @@ jobs:
# Slack channel id, channel name, or user id to post message.
# See also: https://api.slack.com/methods/chat.postMessage#channels
channel-id: 'C07MUHXPX97'
# For posting a rich message using Block Kit
# payload: |
# {
# "username": "Testing Action",
# "text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
# "blocks": [
# {
# "type": "section",
# "text": {
# "type": "mrkdwn",
# "text": "old *bolded* text"
# }
# }
# ]
# }
payload-file-path: "./payload.json"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
Expand All @@ -55,25 +40,19 @@ jobs:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref_name }}

- name: update payload
run: |
var data = JSON.parse(fs.readFileSync("./payload.json"));
data.blocks[3].elements[1].elements[0].elements[0].name = 'red_circle';
echo JSON.stringify(data) > ./payload.json
- uses: slackapi/[email protected]
with:
# Unlike the step posting a new message, this step does not accept a channel name.
# Please use a channel ID, not a name here.
channel-id: "C07MUHXPX97"
update-ts: ${{ needs.initial_msg.outputs.slack_msg_ts }}
payload: |
{
"text": "Blah blah blah",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*bolded* text"
}
}
]
}
payload-file-path: "./payload.json"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

Expand Down
74 changes: 72 additions & 2 deletions payload.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,83 @@
{
"username": "Testing Action",
"text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
"text": "GitHub Action build Status",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "GitHub Action build Status Header",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "old *bolded* text"
"text": "This is a mrkdwn section block :ghost: *this is bold*, and ~this is crossed out~, and <https://google.com|this is a link>"
}
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "Basic bullet list with rich elements\n"
}
]
},
{
"type": "rich_text_list",
"style": "bullet",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "emoji",
"name": "white_circle"
},
{
"type": "text",
"text": "item 1: "
}
]
},
{
"type": "rich_text_section",
"elements": [
{
"type": "emoji",
"name": "white_circle"
},
{
"type": "text",
"text": "item 2: "
}
]
},
{
"type": "rich_text_section",
"elements": [
{
"type": "emoji",
"name": "large_green_circle"
},
{
"type": "text",
"text": "item 3: "
}
]
}
]
}
]
}
]
}

0 comments on commit da60ee6

Please sign in to comment.