Skip to content

silly quotes

silly quotes #10

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: actions/github-script@v7
# with:
# script: |
# const fs = require("fs");
# var file_content = fs.readFileSync("./payload.json");
# var data = JSON.parse(file_content);
# data.blocks[3].elements[1].elements[0].elements[0].name = 'red_circle';
# # echo JSON.stringify(data) > ./payload.json
# fs.writeFileSync("./payload.json", data);
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: |
npm install fs-extra
- name: update payload
run: |
node -e '
const fs = require("fs-extra");
const filePath = "./payload.json";
const json = fs.readJSONSync(filePath);
json.blocks[3].elements[1].elements[0].elements[0].name = "red_circle";
fs.writeJSONSync(filePath, json, { spaces: 2 });
'
- 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 }}