Last active
December 9, 2021 18:23
-
-
Save hugosenari/f42c0807387994fce843a5f956a597d0 to your computer and use it in GitHub Desktop.
Inform Merge
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
| #!/bin/bash | |
| SHIP=":ship: $(echo $GITHUB_REF|cut -f3 -d/)" | |
| PACKAGE=":package: [$(echo $GITHUB_REPOSITORY|cut -f2 -d/)]" | |
| ACTOR=":bust_in_silhouette: ${GITHUB_ACTOR}" | |
| POST_DATA='{\"channel\": \"'$SLACK_BOT_CHANNEL'\", \"text\": \"'$SHIP' \\n '$PACKAGE' \\n '$ACTOR' \"}' | |
| curl -s -X POST \ | |
| -H "Content-type: application/json" \ | |
| -H "Authorization: Bearer ${SLACK_BOT_TOKEN_GIT_ACTION}" \ | |
| -d @<(cat <<EOF | |
| { | |
| "channel": "$SLACK_BOT_CHANNEL", | |
| "text": "$SHIP \n $PACKAGE \n $ACTOR " | |
| } | |
| EOF | |
| ) \ | |
| https://slack.com/api/chat.postMessage |
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
| #!/bin/bash | |
| GIF_URL_VERSION=hugosenari/775386e57b9ffb3b37ff3ce1a3e95114/raw/27baa02a805238c483029d6ade7bad9b723a89b1 | |
| GIFED_BRANCH="${GIFED_BRANCH=master}" | |
| PROD_GIF=` | |
| echo $GITHUB_REF | grep -q -E "$GIFED_BRANCH" && \ | |
| curl -s https://gist.githubusercontent.com/$GIF_URL_VERSION/random_gif_url.sh | \ | |
| bash -s | \ | |
| sed -E 's/.+url":"([^"]+)",\s*"slug.+/\1/' | |
| ` | |
| SHIP=":ship: $(echo $GITHUB_REF|cut -f3 -d/)" | |
| PACKAGE=":package: [$(echo $GITHUB_REPOSITORY|cut -f2 -d/)]" | |
| ACTOR=":bust_in_silhouette: ${GITHUB_ACTOR}" | |
| curl -s -X POST \ | |
| -H "Content-type: application/json" \ | |
| -H "Authorization: Bearer ${SLACK_BOT_TOKEN_GIT_ACTION}" \ | |
| -d @<(cat <<EOF | |
| { | |
| "channel": "$SLACK_BOT_CHANNEL", | |
| "text": "$SHIP \n $PACKAGE \n $ACTOR \\n $PROD_GIF " | |
| } | |
| EOF | |
| ) \ | |
| https://slack.com/api/chat.postMessage |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage with github actions:
When branch is master, it uses random gif with a giphy API and require GIPHY_TOKEN
security
https://dev.to/mheap/improve-your-github-actions-security-1im7
https://www.seancassidy.me/dont-pipe-to-your-shell.html
Since you're pointing to specific version, even if I change this file you will point to old version