Skip to content

Commit

Permalink
factor out slack post into separate action
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Feb 21, 2024
1 parent 6ce0fdc commit 84cb40d
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
set -e
ls -lR

trap 'catch $? $LINENO' EXIT
catch() {
local SLACKAPI="https://ropensci.slack.com/api/chat.postMessage"
local RUNURL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
if [ "$1" != "0" ]; then
local STATUS=FAIL
else
local STATUS=OK
return # only post failures now
fi
echo "::group::Post status to slack"
curl -sS $SLACKAPI -d "text=Deploy $STATUS: $RUNURL" -d "channel=deployments" -H "Authorization: Bearer $SLACK_TOKEN"
echo "::endgroup::"
}
# trap 'catch $? $LINENO' EXIT
# catch() {
# local SLACKAPI="https://ropensci.slack.com/api/chat.postMessage"
# local RUNURL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
# if [ "$1" != "0" ]; then
# local STATUS=FAIL
# else
# local STATUS=OK
# return # only post failures now
# fi
# echo "::group::Post status to slack"
# curl -sS $SLACKAPI -d "text=Deploy $STATUS: $RUNURL" -d "channel=deployments" -H "Authorization: Bearer $SLACK_TOKEN"
# echo "::endgroup::"
# }

# Upload source first
mv package-source package-00source
Expand Down

0 comments on commit 84cb40d

Please sign in to comment.