Send Github pull request notifications to Slack.
- Clone this repo
- Install PostgreSQL in case you don't have it
- Create your
database.yml
andapplication.yml
files. There are sample files in/config
bundle install
- Generate a secret key with
rake secret
and paste this value into theapplication.yml
. - Fill the
SLACK_API_TOKEN
andSLACK_BOT_TOKEN
inapplication.yml
. To get the credentials: log in to https://api.slack.com/apps, select your application and then click OAuth Tokens & Redirect URLs.SLACK_API_TOKEN
is theOAuth Access Token
andSLACK_BOT_TOKEN
isBot User OAuth Access Token
rake db:create
rake db:migrate
rake db:seed
# this will create an admin with [email protected]:passwordnpm install -g ngrok
Install Ngrokrspec
and make sure all tests passrails s
- You are ready!
- Create a dummy repository in github with a couple branches.
- Run server:
rails s -p 3001
- In another terminal run ngrok:
ngrok http 3001
- Copy ngrok url to github configuration page (settings->hooks)
http://xxxxxxx.ngrok.io/api/v1/notifications_filter
- Change CHANNEL in SlackNotificationService to your
@name
or#some_test_channel
- Create/edit pull request adding or removing labels. This will execute the webhook.
Install heroku cli https://devcenter.heroku.com/articles/heroku-cli#download-and-install
- Setup:
heroku login
enter credentials
heroku git:remote -a rootstrap-github-for-slack
- Push:
git push heroku master
Public URLs for exposing your local web server https://ngrok.com/
Info about github hooks and Pull request payload
https://developer.github.com/webhooks/configuring/ https://developer.github.com/v3/activity/events/types/#pullrequestevent