Files
probot/CONTRIBUTING.md
2017-03-13 22:26:59 -05:00

2.3 KiB

Contributing

Running Locally

  1. Clone the repository with git clone https://github.com/bkeepers/PRobot.git
  2. Make sure you have a recent version of Node.js installed
  3. Run $ script/bootstrap to install all the project dependencies
  4. Install ngrok ($ brew cask install ngrok on a mac), which will expose the local server to the internet so GitHub can send webhooks
  5. Run $ script/tunnel to start ngrok, which should output something like Forwarding https://4397efc6.ngrok.io -> localhost:3000
  6. Register an integration on GitHub with:
  • Callback URL and Webhook URL: The full ngrok url above. For example: https://4397efc6.ngrok.io/
  • Secret: development
  • Permissions & events needed will depend on how you use the bot, but for development it may be easiest to enable everything.
  1. Download the private key and move it to private-key.pem in the project directory
  2. Edit .env and fill in all the environment variables
  3. With ngrok still running, open another terminal and run $ script/server to start the server on http://localhost:3000

Whenever you com back to work on the app after you've already had it running once, then you need to:

  1. Run $ script/server
  2. Run $ script/tunnel in another window
  3. ngrok will use a different URL every time it is restarted, so you will have to go into the settings for your Integration and update all the URLs.

Testing

To test with a real GitHub repository, you'll need to create a test repository and install the integration you created above:

  1. Open up the settings for your installation and click "Install"
  2. Create a .probot.js in your repository with: on("issues.opened").comment("Hello World! Your bot is working!");
  3. Open a new issue. Your bot should post a comment (you may need to refresh to see it).

Debugging

  1. Always run $ script/bootstrap and restart the server if package.json has changed.
  2. To turn on verbose logging, start server by running: $ LOG_LEVEL=debug script/server
  3. To see what requests are going out, start the server by running: $ LOG_LEVEL=trace script/server