forked from mirrors/probot
1.7 KiB
1.7 KiB
Development
To run a plugin locally, you'll need to create a GitHub App and configure it to deliver webhooks to your local machine.
- Make sure you have a recent version of Node.js installed
- Create a new GitHub App with:
- Webhook URL: Set to
https://example.com/
and we'll update it in a minute. - Webhook Secret:
development
- Permissions & events needed will depend on how you use the bot, but for development it may be easiest to enable everything.
- Webhook URL: Set to
- Download the private key and move it to the project directory
- Edit
.env
and setAPP_ID
to the ID of the app you just created. - Run
$ npm start
to start the server, which will outputListening on https://yourname.localtunnel.me
; - Update the Webhook URL in the app settings to use the
localtunnel.me
URL.
You'll need to create a test repository and install your app by clicking the "Install" button on the settings page of your app.
Whenever you come back to work on the app after you've already had it running once, you should only need to run $ npm start
.
Optionally, you can also run your plugin through nodemon which will listen on any files changes in your local development environment and automatically restart the server. After installing nodemon, you can run nodemon --exec "npm start"
and from there the server will automatically restart upon file changes.
Debugging
- Always run
$ npm install
and restart the server if package.json has changed. - To turn on verbose logging, start server by running:
$ LOG_LEVEL=trace npm start