Skip to content

core-v1.0.3

core-v1.0.3 #6

name: Slack Release Notification
on:
release:
types: [published]
jobs:
notify-slack:
runs-on: ubuntu-latest # nosemgrep : non-self-hosted-runner
steps:
- name: Build Slack Message
id: build-message
run: |
repo_name="${{ github.repository }}"
version="${{ github.event.release.tag_name }}"
release_body="${{ github.event.release.body }}"
release_url="${{ github.event.release.html_url }}"
# Build the message text
message="Hey folks <!subteam^S6R84Q3J6>, a new release has been made for \`$repo_name\`.\n\nThe latest version is \`$version\`.\n\nChangelog:\n\n\`\`\`\n$release_body\n\`\`\`\n\nLink: $release_url\n\nPlease reach out to <!subteam^S0965FP82NS> for any queries on the release."
# Build complete JSON payload using jq to properly escape
payload=$(jq -n \
--arg channel "#payments-checkout-sdk-releases" \
--arg text "$message" \
'{
channel: $channel,
text: $text
}')
echo "payload<<EOF" >> $GITHUB_OUTPUT
echo "$payload" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Send to Slack
uses: slackapi/[email protected]
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: ${{ steps.build-message.outputs.payload }}