Skip to content

Update message

Update message #22

Workflow file for this run

name: Slack
on:
push:
branches:
- slack
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- name: Get package information
id: package_info
run: |
CHANGES='[{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}]'
echo "changes=${CHANGES}" >> $GITHUB_OUTPUT
- uses: actions/github-script@v7
name: Parse changeset output
id: parse_changes
with:
script: |
const changes = ${{steps.package_info.outputs.changes}};
let message = "🎉 New release!\n\n";
changes.forEach(package => {
message += `*Package Name:* ${package.name}\n*Version:* ${package.version}\n\n`;
});
core.setOutput("blocks",
JSON.stringify({
"text": message
})
);
- name: Send custom JSON data to Slack workflow
id: slack
uses: slackapi/[email protected]
with:
# This data can be any valid JSON from a previous step in the GitHub Action
payload: ${{steps.parse_changes.outputs.blocks}}
env:
SLACK_WEBHOOK_URL: "https://hooks.slack.com/services/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"