Skip to content

Instantly share code, notes, and snippets.

@carloscarucce
Created March 10, 2025 13:10
Show Gist options
  • Save carloscarucce/cf9b9da2a2194b49dcd0c4243b90afd6 to your computer and use it in GitHub Desktop.
Save carloscarucce/cf9b9da2a2194b49dcd0c4243b90afd6 to your computer and use it in GitHub Desktop.
Slack bot release notes with github action
name: Publish Package
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
if: github.event.release.draft == false
steps:
- name: Send slack notification request
run: |
TEXT=$(jq -n \
--arg org "${{ github.repository_owner }}" \
--arg proj "${{ github.repository }}" \
--arg tag "${{ github.event.release.tag_name }}" \
--arg name "${{ github.event.release.name }}" \
--arg desc "${{ github.event.release.body }}" \
'{text: ("Org: " + $org + "\nProject: " + $proj + "\nNew release: " + $tag + " - " + $name + "\nDescription: " + $desc), channel: "${{ vars.SLACK_CHANNEL }}"}')
curl -X POST \
-H 'Content-type: application/json' \
-H 'Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}' \
--data "$TEXT" \
https://slack.com/api/chat.postMessage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment