This sample app showcases how webhooks can be used with a GitHub App's installation token to create a bot that responds to issues. Code uses octokit.js.
.env
file similar to .env.example
and set actual values. If you are using GitHub Enterprise Server, also include a ENTERPRISE_HOSTNAME
variable and set the value to the name of your GitHub Enterprise Server instance.npm install
.npm run server
.smee
, run smee -u <smee_url> -t http://localhost:3000/api/webhook
.With your server running, you can now create a pull request on any repository that your app can access. GitHub will emit a pull_request.opened
event and will deliver the corresponding Webhook payload to your server.
The server in this example listens for pull_request.opened
events and acts on them by creating a comment on the pull request, with the message in message.md
, using the octokit.js rest methods.
To keep things simple, this example reads the GITHUB_APP_PRIVATE_KEY
from the environment. A more secure and recommended approach is to use a secrets management system like Vault, or one offered by major cloud providers: Azure Key Vault, AWS Secrets Manager, Google Secret Manager, etc.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4