Git Product home page Git Product logo

github-bot's Introduction

Node.js GitHub Bot

The Node.js Foundation's uses this bot to help manage the repositories of the GitHub organization. It executes scripts in response to events that are pushed to it via GitHub webhooks. All repositories that use this bot have the same webhook url & secret configured (there is only 1 bot instance). Org-wide webhooks are not allow.

Contributing

Please do, contributions are more than welcome!

Environment Variables

  • GITHUB_TOKEN
    The GitHub API token for your account (or bot account) that will be used to make API calls to GitHub. The account must have proper access to perform the actions required by your script.
  • GITHUB_WEBHOOK_SECRET
    The webhook secret that Githib signs the POSTed payloads with. This is created when the webhook is defined. The default is hush-hush.
  • TRAVIS_CI_TOKEN
    For scripts that communicate with Travis CI. Your Travis token is visible on your profile page, by clicking the "show token" link. Also See: https://blog.travis-ci.com/2013-01-28-token-token-token
  • LOGIN_CREDENTIALS
    Username and password used to protected the log files exposed in /logs. Expected format: username:password.
  • KEEP_LOGS
    Number of days to keep rotated log files in ./logs, defaults to 10 if not set.

Developing Locally

The bot will try to load a .env file at the root of the project if it exists to set environment varaibles. You will need to create one similar to this:

GITHUB_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TRAVIS_CI_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SSE_RELAY=https://hook-relay.herokuapp.com

Note the additional SSE_RELAY variable: When developing locally, it is difficult to setup a GitHub webhook pointing to the computer you are developing on. An easy workaround is to set the SSE_RELAY to the url of a SSE relay server that will send the GitHub events via Server Sent Events instead.

You can use the TestOrgPleaseIgnore GitHub Organization, to test your changes. Actions performed on the repos there will be sent to the SSE Relay.

The GITHUB_WEBHOOK_SECRET environment variable is not required when using the relay.

Run the bot:

$ npm start

When developing a script, it is likely that you will only want to run the script(s) that you are working on. You may pass an additional glob argument to specify which scripts to run.

$ npm start ./scripts/my-new-event-handler.js

License

MIT

github-bot's People

Contributors

phillipj avatar fishrock123 avatar williamkapke avatar mscdex avatar chorrell avatar

Stargazers

 avatar

Watchers

James Cloos avatar Hans Kristian Flaatten avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.