Skip to content

your github notifications to slack, notifications customizer

License

Notifications You must be signed in to change notification settings

shzxcv/github-notifications-to-slack

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github Notifications To Slack

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

Notify Slack of your github notifications, which can be scheduled to run using Github Actions.

actions

Slack

image

You can register a white list and black list of repositories to be notified.

Usage

  1. Need to create a slack bot. Access Slack Applications.
  2. [Create new app] -> [From scratch]
  3. [OAuth & Permissions] -> Add chat:write to Bot Token Scopes and re install.
  4. Create a github token. Access Personal access tokens, Tokens require the score of repo, notifications.
  5. Create a repository to run scheduled notifications github actions and create the following Actions.

.github/workflows/slack-notify.yml

on:
  schedule:
    - cron: "*/10 * * * *"

jobs:
  notify:
    runs-on: ubuntu-latest
    name: notify
    steps:
      - uses: actions/checkout@v3
      - name: Github Notifications To Slack
        uses: shzxcv/github-notifications-to-slack@v1
        env:
          NOTIFICATION_GITHUB_TOKEN: ${{ secrets.NOTIFICATION_GITHUB_TOKEN }}
          SLACK_BOT_OAUTH_TOKEN: ${{ secrets.SLACK_BOT_OAUTH_TOKEN }}
          SLACK_USER_ID: ${{ secrets.SLACK_USER_ID }}
  1. Register environment variables in the Actions secrets.

Environment Variables

Variable Required Purpose
NOTIFICATION_GITHUB_TOKEN true The token of the github account. repo and notifications scopes are required.
SLACK_BOT_OAUTH_TOKEN true bot token for the slack app to be notified. chat:write is required.
SLACK_CHANNEL false Specify the slack channel to be notified. (#test-channel)

* Either SLACK_CHANNEL or SLACK_USER_ID is required.
SLACK_USER_ID false The user id of the slack user to whom the Direct Message will be sent.(U01ABCD23EF)

* Either SLACK_CHANNEL or SLACK_USER_ID is required.
INCLUDE_GITHUB_REPOS false Repository to be included in the notification. (shzxcv/repo1,shzxcv/repo2)

* If the same repository is registered in INCLUDE_GITHUB_REPOS and EXCLUDE_GITHUB_REPOS, INCLUDE_GITHUB_REPOS has priority.
EXCLUDE_GITHUB_REPOS false Repository to exclude notifications. (shzxcv/repo1,shzxcv/repo2)

License

MIT