• Stars
    star
    1,062
  • Rank 43,153 (Top 0.9 %)
  • Language
    Go
  • License
    MIT License
  • Created over 5 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GitHub Action for sending a notification to a Slack channel

This action is a part of GitHub Actions Library created by rtCamp.

Slack Notify - GitHub Action

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

A GitHub Action to send a message to a Slack channel.

Screenshot

action-slack-notify-rtcamp

The Site and SSH Host details are only available if this action is run after Deploy WordPress GitHub action.

Usage

You can use this action after any other action. Here is an example setup of this action:

  1. Create a .github/workflows/slack-notify.yml file in your GitHub repo.
  2. 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 }}
  1. Create SLACK_WEBHOOK secret using GitHub Action's Secret. You can generate a Slack incoming webhook token from here.

Environment Variables

By default, action is designed to run with minimal configuration but you can alter Slack notification using following environment variables:

Variable Default Purpose
SLACK_CHANNEL Set during Slack webhook creation Specify Slack channel in which message needs to be sent
SLACK_USERNAME rtBot Custom Slack Username sending the message. Does not need to be a "real" username.
SLACK_MSG_AUTHOR $GITHUB_ACTOR (The person who triggered action). GitHub username of the person who has triggered the action. In case you want to modify it, please specify corrent GitHub username.
SLACK_ICON rtBot Avatar User/Bot icon shown with Slack message. It uses the URL supplied to this env variable to display the icon in slack message.
SLACK_ICON_EMOJI - User/Bot icon shown with Slack message, in case you do not wish to add a URL for slack icon as above, you can set slack emoji in this env variable. Example value: :bell: or any other valid slack emoji.
SLACK_COLOR good (green) You can pass ${{ job.status }} for automatic coloring or an RGB value like #efefef which would change color on left side vertical line of Slack message.
SLACK_LINK_NAMES - If set to true, enable mention in Slack message.
SLACK_MESSAGE Generated from git commit message. The main Slack message in attachment. It is advised not to override this.
SLACK_TITLE Message Title to use before main Slack message.
SLACK_FOOTER Powered By rtCamp's GitHub Actions Library Slack message footer.
MSG_MINIMAL - If set to true, removes: Ref, Event, Actions URL and Commit from the message. You can optionally whitelist any of these 4 removed values by passing it comma separated to the variable instead of true. (ex: MSG_MINIMAL: event or MSG_MINIMAL: ref,actions url, etc.)

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:

Screenshot_2019-03-26_at_5_56_05_PM

The Site and SSH Host details are only available if this action is run after Deploy WordPress GitHub action.

Hashicorp Vault (Optional)

This GitHub action supports Hashicorp Vault.

To enable Hashicorp Vault support, please define following GitHub secrets:

Variable Purpose Example Vaule
VAULT_ADDR Vault server address https://example.com:8200
VAULT_TOKEN Vault token s.gIX5MKov9TUp7iiIqhrP1HgN

You will need to change secrets line in slack-notify.yml file to look like below.

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:
        VAULT_ADDR: ${{ secrets.VAULT_ADDR }}
        VAULT_TOKEN: ${{ secrets.VAULT_TOKEN }}

GitHub action uses VAULT_TOKEN to connect to VAULT_ADDR to retrieve slack webhook from Vault.

In the Vault, the Slack webhook should be setup as field webhook on path secret/slack.

Credits

Source: technosophos/slack-notify

License

MIT Β© 2022 rtCamp

Does this interest you?

Join us at rtCamp, we specialize in providing high performance enterprise WordPress solutions

More Repositories

1

wp-decoupled

Next.js app with WPGraphQL and WordPress at the backend.
JavaScript
266
star
2

nginx-helper

Nginx Helper for WordPress caching, permalinks & efficient file handling in multisite
PHP
228
star
3

VueTheme

WordPress theme using Rest API and Vue.js
CSS
220
star
4

gutenberg-fields-middleware

Register fields for Gutenberg blocks with less repetitive code
JavaScript
167
star
5

rtMedia

rtMedia (formerly Buddypress Media) adds advanced multimedia functionality to WordPress, BuddyPress and bbPress
PHP
123
star
6

action-deploy-wordpress

GitHub Action for deploying a WordPress site using using PHP's Deployer.org
Shell
120
star
7

Frappe-Manager

A CLI tool based on Docker Compose to easily manage Frappe based projects.
Python
106
star
8

action-phpcs-code-review

Github Action to perform automated code review on pull requests
Shell
101
star
9

github-actions-library

Collection of Github Actions useful for WordPress Deployments
93
star
10

wp-partytown

Add partytown support to WordPress sites.
JavaScript
74
star
11

login-with-google

Minimal plugin which allows WordPress user to login with google.
PHP
57
star
12

learn

rtCamp assignment and issue tracker
52
star
13

rtpanel

WordPress Theme Framework
PHP
43
star
14

gitbook-plugin-edit-link

GitBook Plugin to add "Edit with Github (or Gitlab)" link on every page
JavaScript
42
star
15

wordpress-skeleton

A base repository structure for rtCamp's WordPress sites, pre-configured to use Github Actions
PHP
40
star
16

gutenberg-supplements

JavaScript
28
star
17

rtsocial

rtSocial is lightest wordpress plugin for facebook & twitter social sharing
PHP
26
star
18

theme-elementary

A starter theme that facilitates a quick headstart for developing new block-based themes along with a bunch of developer-friendly features.
JavaScript
26
star
19

wpveda-book

We now have our own training module which has all the lessons that covers the core topics on WordPress and the various steps involved in WordPress development. Check it out
Shell
25
star
20

blank-theme

Customized Blank theme based on Underscore and Foundation
PHP
25
star
21

gitbook-plugin-collapsible-menu

GitBook Plugin to change sidebar menu's to collapsible menu. For gitbook with many pages, navigating long menus can get irritating.
JavaScript
24
star
22

woocommerce-to-easydigitaldownloads

A script to migrate products, orders, payments and other stuff from WooCommerce to EasyDigitalDownloads
PHP
21
star
23

rt-optimizer

A WordPress plugin that improves Core Web Vitals score by loading scripts via worker thread. Keeps the main thread idle for users to interact with page as quickly as possible.
PHP
18
star
24

rtpanel-child-theme

Example child theme for rtPanel wordpress theme framework
CSS
16
star
25

rtbiz

WordPress 4 Business!
PHP
16
star
26

web-story-creation-tool

Demo https://rtcamp.github.io/web-story-creation-tool
JavaScript
16
star
27

wp-menu-custom-fields

An example of custom fields for menu in WordPress 5.4+
TypeScript
16
star
28

woobench-woocommerce-load-testing

WooCommerce Benchmarking
Python
14
star
29

gitlab-to-github-migration

Migrate GitLab project to GitHub
PHP
12
star
30

rt-lib

rt-lib is (intended to be) collection of reusable PHP classes useful for WordPress plugin/theme projects
PHP
12
star
31

transcoder

This WordPress plugin, useful to transcode audio and video file from any format to mp3 and mp4 respectively. Also it will generate thumbnails of videos.
PHP
10
star
32

action-phpcs-inspection

GitHub Action for PHPCS inspection.
Dockerfile
10
star
33

rt-newrelic-browser

NewRelic Browser Monitoring (Real User Monitoring) WordPress
PHP
10
star
34

wp-plugin-bootstrap

A skeleton wordpress plugin to bootstrap & standardize your development
Shell
9
star
35

rtsyntax

A lightweight syntax highlighter for WordPress
CSS
9
star
36

visual-automation-backstop

Visual automation with Backstop JS
JavaScript
9
star
37

media-node

A node.js wrapper for ffmpeg. Made for https://github.com/rtCamp/buddypress-media but can be used in any project which needs FFMPEG
Shell
9
star
38

docs.rtcamp.com

Documentation for rtCamp projects/products
CSS
8
star
39

gutenberg-plugin-boilerplate

Simple Gutenberg Boilerplate for plugin development
JavaScript
8
star
40

wordpress-preview-revisions

WordPress Preview Revisions Plugin help editors to preview the revisions with exact same content that would look like on the frontend.
PHP
7
star
41

ninja-to-gravity

PHP
7
star
42

pwa-wordpress-plugin

WordPress Plugin to enable PWA features.
PHP
7
star
43

search-with-google

A plugin for replacing WordPress default search with Google Custom Search results.
TypeScript
7
star
44

httperf

httperf clone with fix for FD_SETSIZE (open file limit)
C
7
star
45

amp-admanager

Easy and hassle free Google Admanager amp-ad tags integration for all WordPress sites. (AMP and Non-AMP)
PHP
5
star
46

rtpanel-hooks-editor

rtPanel hooks editor plugin provides user-interface for rtPanel WordPress Theme Framework
PHP
5
star
47

my-comment-manager

Better comment management for wordpress
PHP
5
star
48

action-wordpress-org-plugin-deploy

Shell
4
star
49

web-stories-ad-tool

Ad creation tool for google web stories. https://rtcamp.github.io/web-stories-ad-tool
JavaScript
4
star
50

automate-slack-invite-gravityforms

GravityForms addon to invite a user on Slack automatically
PHP
4
star
51

blogger-to-wordpress

Blogger to WordPress Redirection Plugin
TypeScript
4
star
52

rtmedia-code-snippets

This is custom code library for rtMedia core and premium add-ons
PHP
4
star
53

gitlab-bulk-delete-users

Delete users in bulk from Gitlab setup using rake tasks
Ruby
4
star
54

wporg-api-client

WordPress.org API client built in node.js
JavaScript
3
star
55

dockerfiles

Various Dockerfiles in use by rtCamp.
Dockerfile
3
star
56

amp-onesignal-compat

A WordPress Plugin to add AMP compatibility to OneSignal – Web Push Notifications
PHP
3
star
57

pwa-extension

Enables PWA features such as add to homescreen, offline reading features.
PHP
3
star
58

api_playwright_utils

API Automation Testing with Playwright
JavaScript
3
star
59

integrate-woocommerce-gitlab

With this code users can connect GitLab to WooCommerce, users will get source code repositories access as a Guest, Reporter, Developer or Master
PHP
3
star
60

wp-cli-report-command

Lists the plugin and theme usage for a multisite
PHP
2
star
61

wercker-step-wordpress-svn

Wercker deploy step for wordpress.org plugin svn repo
Shell
2
star
62

rtbiz-helpdesk

PHP
2
star
63

migrate-wufoo-to-gravity-forms

Import content from wufoo to Gravity Form- Entries, Comments and attachments.
PHP
2
star
64

blocks-bento-variations

PHP
2
star
65

px-wp-insights

AMP Compatibility Database
JavaScript
2
star
66

amp-generic-compat

AMP plugin to provide generic compatibility for Elements with hide and show toggle feature
PHP
2
star
67

rtWidgets

Sidebar Widgets Collection for rtPanel Theme Framework mainly. Might work on other theme as well.
PHP
2
star
68

embed-google-drive

TypeScript
2
star
69

rtmoto

rtMoto Theme
PHP
2
star
70

mention-links

Plugin which brings Github style user @mentions and article #links to the WordPress
TypeScript
2
star
71

stripe-xero-csv

Export Stripe's balance affecting transactions in a CSV file, recognisable by Xero Import CSV Statement feature.
PHP
2
star
72

action-deploy-frappe

Shell
2
star
73

edit-flow-slack-integration

This plugin is to send slack notification when editotial comment added.
PHP
1
star
74

lando-wordpress-skeleton

PHP
1
star
75

action-deploy-on-managed-instance

Shell
1
star
76

amp-infinite-scroll

AMP plugin for infinite scroll
PHP
1
star
77

web-stories-playground

JavaScript
1
star
78

rtAdmin

PHP-CLI nginx vhost creation script. Succeeded by https://github.com/rtCamp/easyengine
PHP
1
star
79

rtAntiSpam

WordPress login/register sidebar widget with recaptcha support
PHP
1
star
80

wp-cls-terminator

Remove CLS from Block Editor Embeds
JavaScript
1
star
81

gravityforms-sfmc-data-extension

Gravity Forms add-on to send entry data to a Salesforce Marketing Cloud Data Extension
PHP
1
star
82

rt-google-analytics-scroll-tracking

Integrates jquery-scrolldepth with Google Analytics by Yoast
JavaScript
1
star
83

amp-colormag-compat

Adds Compatibility to WordPress ColorMag theme.
PHP
1
star
84

gitolite-setup

Setup scripts for Gitolite v3
Shell
1
star
85

AMP-Extensions-Mini-Plugins

Monorepo contains different AMP extension plugins
PHP
1
star
86

psat-demos

EJS
1
star
87

rtmedia-transcoding-service-old

rtmedia Transcoding Plugin for rtMedia and WordPress Media Library
PHP
1
star
88

rt-react-theme

JavaScript
1
star
89

amp-email-subscribers

AMP compatibility for Email Subscribers & Newsletters – Simple and Effective Email Marketing WordPress Plugin by icegram
PHP
1
star