Created
March 10, 2025 13:10
-
-
Save carloscarucce/cf9b9da2a2194b49dcd0c4243b90afd6 to your computer and use it in GitHub Desktop.
Slack bot release notes with github action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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