probot.log()
, app.log()
and
context.log()
are aliasing
.log.info()
. We will probably remove the
aliasing in future.
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();
});
};
An authenticated GitHub API client
Returns an Octokit instance with default settings for
authentication. If a githubToken
is passed
explicitly, the Octokit instance will be pre-authenticated
with that token when instantiated. Otherwise Octokit's
app authentication strategy is used, and
options.auth
options are merged deeply when
instantiated.
Besides the authentication, the Octokit's baseUrl is set as well when run against a GitHub Enterprise Server with a custom domain.
Detects if Probot is likely running in a test environment.
Note: This method only detects Jest
environments or when NODE_ENV starts with test
.
Returns true
if Probot is in a test environment.
The base event name refers to the part before the first
period mark (e.g. the issues
part in
issues.opened
).
Returns false
when the application is not
subscribed to a webhook event. Otherwise, returns
true
. Returns undefined
if Probot
failed to retrieve GitHub App metadata.
Note: Probot will only check against a list
of events known to be in the GET /app
response.
Therefore, only the false
value should be
considered truthy.
Loads an ApplicationFunction into the current Application
Probot application function to load
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
Check if an application is subscribed to an event.
Returns false
if the app is not subscribed to an
event. Otherwise, returns true
. Returns
undefined
if the webhook-event-check feature is
disabled or if Probot failed to retrieve the GitHub App's
metadata.
Generated using TypeDoc
cert
options is deprecated. UseprivateKey
instead