mirror of
https://github.com/zhigang1992/probot.git
synced 2026-06-15 18:37:42 +08:00
1.8 KiB
1.8 KiB
Development
To run a plugin locally, you'll need to create a GitHub Integration and configure it to deliver webhooks to your local machine.
- Make sure you have a recent version of Node.js installed
- Install ngrok (
$ brew cask install ngrokon a mac), which will expose the local server to the internet so GitHub can send webhooks - Run
$ ngrok http 3000to start ngrok, which should output something likeForwarding https://4397efc6.ngrok.io -> localhost:3000 - Create a new GitHub Integration with:
- Callback URL and Webhook URL: The full ngrok url above. For example:
https://4397efc6.ngrok.io/ - Webhook Secret:
development - Permissions & events needed will depend on how you use the bot, but for development it may be easiest to enable everything.
- Callback URL and Webhook URL: The full ngrok url above. For example:
- Download the private key and move it to
private-key.pemin the project directory - Edit
.envand setINTEGRATION_IDto the ID of the integration you just created. - With
ngrokstill running, open another terminal and run$ npm startto start the server on http://localhost:3000
You'll need to create a test repository and install your Integration by clicking the "Install" button on the settings page.
Whenever you com back to work on the app after you've already had it running once, then you need to:
- Run
$ npm start - Run
$ ngrok http 3000in another terminal 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.
Debugging
- Always run
$ npm installand restart the server if package.json has changed. - To turn on verbose logging, start server by running:
$ LOG_LEVEL=trace npm start