(Forked from rtCamp/action-slack-notify)
This repo builds a Go binary based on this image and then starts it with a shell script. This avoids unnecessary usage of Docker. It can even be used in the same way as the original. Some things have been ripped out of the shell scripts since we provide those environment variables already and wanted to avoid installing extra dependencies.
sudo apt install upx
NOTE: All builds are expected to target Linux.
env GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/slack-notify main.go
sudo upx --brute ./bin/slack-notify
$Env:GOOS = "linux"; $Env:GOARCH = "amd64"; go build -ldflags="-s -w" -o bin/slack-notify main.go
wsl bash -c -i "sudo upx --brute ./bin/slack-notify"
You may need to update permissions for Linux on Windows. You can do this with
git update-index --chmod=+x ./bin/slack-notify
This action is a part of GitHub Actions Library created by rtCamp.
A GitHub Action to send a message to a Slack channel.
Screenshot
The Site
and SSH Host
details are only available if this action is run
after Deploy WordPress GitHub action.
You can use this action after any other action. Here is an example setup of this action:
- Create a
.github/workflows/slack-notify.yml
file in your GitHub repo. - Add the following code to the
slack-notify.yml
file.
on: push
name: Slack Notification Demo
jobs:
slackNotification:
name: Slack Notification
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- Create
SLACK_WEBHOOK
secret using GitHub Action's Secret . You can generate a Slack incoming webhook token from here.
By default, action is designed to run with minimal configuration but you can alter Slack notification using following environment variables:
You can see the action block with all variables as below:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: general
SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
SLACK_ICON: https://github.com/rtCamp.png?size=48
SLACK_MESSAGE: 'Post Content :rocket:'
SLACK_TITLE: Post Title
SLACK_USERNAME: rtCamp
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Below screenshot help you visualize message part controlled by different variables:
The Site
and SSH Host
details are only available if this action is run
after Deploy WordPress GitHub action.
Source: technosophos/slack-notify
MIT © 2022 rtCamp