This commit is contained in:
eric sciple 2020-01-24 12:20:19 -05:00
parent beb1329f9f
commit 2b95e76931
7736 changed files with 1874747 additions and 51184 deletions

View file

@ -4,9 +4,9 @@
## Usage
Returns an [Octokit SDK] client. See https://octokit.github.io/rest.js for the API.
Returns an Octokit client. See https://octokit.github.io/rest.js for the API.
```
```js
const github = require('@actions/github');
const core = require('@actions/core');
@ -15,7 +15,7 @@ const myToken = core.getInput('myToken');
const octokit = new github.GitHub(myToken);
const pulls = await octokit.pulls.get({
const { data: pullRequest } = await octokit.pulls.get({
owner: 'octokit',
repo: 'rest.js',
pull_number: 123,
@ -24,18 +24,20 @@ const pulls = await octokit.pulls.get({
}
});
console.log(pulls);
console.log(pullRequest);
```
You can also make GraphQL requests:
You can pass client options (except `auth`, which is handled by the token argument), as specified by [Octokit](https://octokit.github.io/rest.js/), as a second argument to the `GitHub` constructor.
```
You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API.
```js
const result = await octokit.graphql(query, variables);
```
Finally, you can get the context of the current action:
```
```js
const github = require('@actions/github');
const context = github.context;