Authenticate and get a GitHub client that can be used to make API calls.
You'll probably want to use context.github
instead.
Note: app.auth
is asynchronous, so it needs to be prefixed with a
await
to wait for the magic to happen.
module.exports = (app) => {
app.on('issues.opened', async context => {
const github = await app.auth();
});
};
ID of the installation, which can be extracted from
context.payload.installation.id
. If called without this parameter, the
client wil authenticate as the app
instead of as a specific installation, which means it can only be used for
app APIs.
An authenticated GitHub API client
Loads an ApplicationFunction into the current Application
Probot application function to load
Listen for GitHub webhooks, which are fired for almost every significant action that users take on GitHub.
the name of the GitHub webhook
event. Most events also
include an "action". For example, the * issues
event has actions of assigned
, unassigned
, labeled
, unlabeled
,
opened
, edited
, milestoned
, demilestoned
, closed
, and reopened
.
Often, your bot will only care about one type of action, so you can append
it to the event name with a .
, like issues.closed
.
app.on('push', context => {
// Code was just pushed.
});
app.on('issues.opened', context => {
// An issue was just opened.
});
a function to call when the webhook is received.
Get an express router that can be used to expose HTTP endpoints
module.exports = app => {
// Get an express router to expose new HTTP endpoints
const route = app.route('/my-app');
// Use any middleware
route.use(require('express').static(__dirname + '/public'));
// Add a new route
route.get('/hello-world', (req, res) => {
res.end('Hello World');
});
};
the prefix for the routes
Generated using TypeDoc
The
app
parameter available toApplicationFunction
s{logger} log - A logger