An ASP.NET Core webhook for automatically responding to GitHub issues and PRs.
Open an issue against this repository to receive an automated response.
- Install .NET Core
git clone https://github.com/jamesseanwright/github-autoresponder.git
cd github-autoresponder
dotnet restore
Then one can run:
dotnet xunit
- execute the unit testsdotnet start
- start the server
The sole exposed endpoint can be found at /api/webhook
, which:
- responds to
HTTP POST
- accepts GitHub webhook-conforming payloads
- is secured by the signature found in the
X-Hub-Signature
header
This service requires two environment variables to function:
The secret token specified when registering the webhook in your repository's settings.
A Base64-encoded string following a <responding_username>:<personal_api_token>
format e.g. "jamesseanwright:somerandomsha1"
responding_username
- the username used to respond to issues and PRspersonal_api_token
- the personal API token to be used, along with the username, to authenticate requests made to the GitHub API- Note that the only required scope is public_repo
- Go to one of your repositories
- Click Settings
- Click Webhooks
- In Payload URL, enter the absolute URL via which the webhook can be accessed, including the
/api/webhook
path - Select application/json from the Content type dropdown
- Enter the webhook secret that you most likely generated in the previous section (see
GHAR_SECRET
) - Under Which events would you like to trigger this webhook?, choose Let me select individual events, and select: Issues; and Pull request
- Click Add webhook to complete the registration
Currently, the response message is a hard-coded string that lives in the ResponseFactory
class. Eventually, this will be separated into a Markdown file to be read at startup.