Skip to content

Update payload file… #5

Update payload file…

Update payload file… #5

Workflow file for this run

name: Slack Notifications
on:
push:
jobs:
initial_msg:
runs-on: ubuntu-latest
outputs:
slack_msg_ts: ${{ steps.slack1.outputs.ts }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref_name }}
# C07MUHXPX97
- name: Post to a Slack channel
id: slack1
uses: slackapi/[email protected]
with:
# Slack channel id, channel name, or user id to post message.
# See also: https://api.slack.com/methods/chat.postMessage#channels
channel-id: 'C07MUHXPX97'
payload-file-path: "./payload.json"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
update_1:
runs-on: ubuntu-latest
needs: initial_msg
steps:
- uses: actions/checkout@v4
with:
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-file-path: "./payload.json"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
reply_1:
runs-on: ubuntu-latest
needs: initial_msg
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref_name }}
- uses: slackapi/[email protected]
with:
channel-id: "C07MUHXPX97"
payload: |
{
"thread_ts": "${{ needs.initial_msg.outputs.slack_msg_ts }}",
"text": "Deployment finished (Completed)"
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}