Reads the app configuration from the given YAML file in the .github
directory of the repository.
For example, given a file named .github/config.yml
:
close: true
comment: Check the specs on the rotary girder.
You app can read that file from the target repository:
// Load config from .github/config.yml in the repository
const config = await context.config('config.yml')
if (config.close) {
context.github.issues.comment(context.issue({body: config.comment}))
context.github.issues.edit(context.issue({state: 'closed'}))
}
You can also use a defaultConfig
object:
// Load config from .github/config.yml in the repository and combine with default config
const config = await context.config('config.yml', {comment: 'Make sure to check all the specs.'})
if (config.close) {
context.github.issues.comment(context.issue({body: config.comment}));
context.github.issues.edit(context.issue({state: 'closed'}))
}
Name of the YAML file in the .github
directory
An object of default config options
Configuration object read from the file
Return the owner
, repo
, and number
params for making API requests
against an issue or pull request. The object passed in will be merged with
the repo params.
const params = context.issue({body: 'Hello World!'})
// Returns: {owner: 'username', repo: 'reponame', number: 123, body: 'Hello World!'}
Params to be merged with the issue params.
Return the owner
and repo
params for making API requests against a
repository.
const params = context.repo({path: '.github/config.yml'})
// Returns: {owner: 'username', repo: 'reponame', path: '.github/config.yml'}
Params to be merged with the repo params.
Generated using TypeDoc
Returns a boolean if the actor on the event was a bot.
{boolean}