Constructor
+ + +new Context()
+ + + + + + + + + +Properties:
+ + + +| Name | + + +Type | + + + + + +Description | +
|---|---|---|
github |
+
+
+
+
+
+github
+
+
+
+ |
+
+
+
+
+
+ An authenticated GitHub API client |
+
payload |
+
+
+
+
+
+payload
+
+
+
+ |
+
+
+
+
+
+ The webhook event payload |
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + context.js, line 11 +
+
+
+
+
+
+
+
+
Members
+ + + +isBot :boolean
+ + + + +Returns a boolean if the actor on the event was a bot.
+-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + context.js, line 61 +
+
+
+
+
+
+
+
+
Type:
+-
+
-
+
+
boolean+ + +
+
Methods
+ + + +config(fileName, defaultConfigopt) → {Promise.<Object>}
+ + + + + +Reads the plugin configuration from the given YAML file in the .github
+directory of the repository.
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + context.js, line 88 +
+
+
+
+
+
+
+
+
Parameters:
+ + +| Name | + + +Type | + + +Attributes | + + + + +Description | +
|---|---|---|---|
fileName |
+
+
+
+
+
+string
+
+
+
+ |
+
+
+ + + + + + + | + + + + +
+ Name of the YAML file in the |
+
defaultConfig |
+
+
+
+
+
+object
+
+
+
+ |
+
+
+
+
+ <optional> + + + + + + |
+
+
+
+
+
+ An object of default config options + + |
+
Returns:
+ + + +-
+
- + Type: + +
-
+
+
Promise.<Object>+ + +
+
-
+
- Configuration object read from the file +
Examples
+ +Contents of .github/myplugin.yml.
close: true
+comment: Check the specs on the rotary girder.
+
+ Plugin that reads from .github/myplugin.yml.
// Load config from .github/myplugin.yml in the repository
+const config = await context.config('myplugin.yml');
+
+if(config.close) {
+ context.github.issues.comment(context.issue({body: config.comment}));
+ context.github.issues.edit(context.issue({state: 'closed'}));
+}
+
+issue(objectopt)
+ + + + + +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.
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + context.js, line 50 +
+
+
+
+
+
+
+
+
Parameters:
+ + +| Name | + + +Type | + + +Attributes | + + + + +Description | +
|---|---|---|---|
object |
+
+
+
+
+
+object
+
+
+
+ |
+
+
+
+
+ <optional> + + + + + + |
+
+
+
+
+
+ Params to be merged with the issue params. + + |
+
Example
+ +const params = context.issue({body: 'Hello World!'})
+// Returns: {owner: 'username', repo: 'reponame', number: 123, body: 'Hello World!'}
+
+repo(objectopt)
+ + + + + +Return the owner and repo params for making API requests against a
+repository.
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Source: +
- + context.js, line 29 +
+
+
+
+
+
+
+
+
Parameters:
+ + +| Name | + + +Type | + + +Attributes | + + + + +Description | +
|---|---|---|---|
object |
+
+
+
+
+
+object
+
+
+
+ |
+
+
+
+
+ <optional> + + + + + + |
+
+
+
+
+
+ Params to be merged with the repo params. + + |
+
Example
+ +const params = context.repo({path: '.github/stale.yml'})
+// Returns: {owner: 'username', repo: 'reponame', path: '.github/stale.yml'}
+
+