mirror of
https://github.com/zhigang1992/probot.git
synced 2026-06-18 07:19:08 +08:00
2.3 KiB
2.3 KiB
Contributing
Running Locally
- Clone the repository with
git clone https://github.com/bkeepers/PRobot.git - Make sure you have a recent version of Node.js installed
- Run
$ script/bootstrapto install all the project dependencies - Install ngrok (
$ brew cask install ngrokon a mac), which will expose the local server to the internet so GitHub can send webhooks - Run
$ script/tunnelto start ngrok, which should output something likeForwarding https://4397efc6.ngrok.io -> localhost:3000 - 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.
- Download the private key and move it to
private-key.pemin the project directory - Edit
.envand fill in all the environment variables - With
ngrokstill running, open another terminal and run$ script/serverto 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:
- Run
$ script/server - Run
$ script/tunnelin another window ngrokwill 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:
- Open up the settings for your installation and click "Install"
- Create a
.probot.jsin your repository with: on("issues.opened").comment("Hello World! Your bot is working!"); - Open a new issue. Your bot should post a comment (you may need to refresh to see it).
Debugging
- Always run
$ script/bootstrapand restart the server if package.json has changed. - To turn on verbose logging, start server by running:
$ LOG_LEVEL=debug script/server - To see what requests are going out, start the server by running:
$ LOG_LEVEL=trace script/server