notify-slack

Send only task-related notifications from GitHub to Slack

MIT License

Stars
4
Committers
2

notify-slack

Send only task-related notifications from GitHub to Slack

Message Examples on Slack

Users only specified in userlist.toml will be notified through Slack.

All types of users

  • Received a mention on a PR or an issue
    • 💬 ken-matsui-developer mentioned you on ken-matsui/notify-slack #1

      ken-matsui-developer Comment on #1 Testing Notifications @ken-matsui-reviewer Hi, I am testing notifications using ken-matsui/notify-slack. Please let me know if you receive any notification on Slack. ken-matsui/notify-slack | Jan 6th

Reviewers

Developers

Usage

You will need to prepare two files on your repository which you want to configure.

1. Workflow file

.github/workflows/notify-slack.yml

name: GitHub Notification

on:
  pull_request:
    types: [review_requested, closed]
  pull_request_review:
    types: [submitted]
  issue_comment:
  pull_request_review_comment:

jobs:
  notify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: ken-matsui/[email protected]
        with:
          slack_oauth_access_token: ${{ secrets.SLACK_OAUTH_ACCESS_TOKEN }}

2. User list file

.github/userlist.toml

[[users]]
github = "ken-matsui"
slack = "UXXXXXXXXXX"

[[users]]
github = "ken-matsui-2"
slack = "UXXXXXXXXXX"

Frequently Asked Questions

How to obtain an OAuth token of a Slack App?

  1. Go to Your Apps on slack.com
  2. Click Create New App, and select From scratch
  3. Input App Name (e.g. GitHub Notification), and select your workspace
  4. Click Create App
  5. Expand Add features and functionality in Building Apps for Slack, and click Permissions
  6. Go to the Scopes section, and click Add an OAuth Scope in Bot Token Scopes
  7. Select chat:write
  8. Go on the top of the current page, and click Install to Workspace on the OAuth Tokens for Your Workspace section
  9. Click Allow
  10. Copy an OAuth access token shown as Bot User OAuth Token

How to find a Slack user ID?

See https://www.workast.com/help/articles/61000165203/.

Are there any inputs and outputs?

This action has only a slack_oauth_access_token input and no outputs.

Contributing

First, you'll need to have a reasonably modern version of node handy. This won't work with versions older than 9, for instance.

Install the dependencies

$ npm install

Build the typescript and package it for distribution

$ npm run build && npm run package

Publish to a distribution branch

Actions are run from GitHub repos so we will checkin the packed dist folder.

Then run ncc and push the results:

$ npm run package
$ git add dist
$ git commit -m "prod dependencies"
$ git tag v1.0.0
$ git push origin v1.0.0

Note: We recommend using the --license option for ncc, which will create a license file for all of the production node modules used in your project.

Your action is now published! 🚀

See the versioning documentation

Package Rankings
Top 22.88% on Github actions