kroitor / git-slack-notify

Sends Slack notifications for new commits in Git repositories

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

git-slack-notify

pic

  • Tracks new commits in multiple local Git repositories using git fetch && git log --all
  • Reports them to Slack channels
  • Written in JavaScript — your grandmother can easily read it

TODO

  • Automated tests

Install

You will need NPM.

git clone http://github.com/xpl/git-slack-notify
cd git-slack-notify
npm install

Run

npm start

Configure

Default config name will be config.json. Running with other file:

npm start myconfig.json

If not found, it will be auto-generated with example data:

{
    accessToken: '<your Slack OAuth access token here>',

    fetchFrequency: 30000, // check for new commits each 30s

    repos: [                                    // you can track multiple repositories
        {
            name: 'Git Slack Notify',           // display name (optional, if not set, will be generated from `dir`)
            dir: process.cwd (),                // local git repo path
            channel: 'general',                 // where to post
            lastTopCommitHash: ''               // this is auto-updated when new commits arrive
        }
    ]
}

Obtaining accessToken

  1. Create a new Slack App at https://api.slack.com/apps
  2. Activate the "Incoming webhooks" feature
  3. Click on "Install app to your team" (will generate the token)
  4. Under "OAuth & Permissions", grab your "OAuth Access Token"

About

Sends Slack notifications for new commits in Git repositories

License:The Unlicense


Languages

Language:JavaScript 100.0%