1
0
Fork 0

[@actions/github] Fix code example, add syntax highlighting (#43)

* [@actions/github] Fix code example, add syntax highlighting

* [@actions/github] add link to @octkit/graphql API

* [@octokit/github] moar syntax highlighting in README
pull/44/head
Gregor Martynus 2019-08-07 14:23:44 -07:00 committed by Danny McCormick
parent a40bce7c8d
commit aec0ef46e4
1 changed files with 7 additions and 7 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,18 @@ const pulls = await octokit.pulls.get({
}
});
console.log(pulls);
console.log(pullRequest);
```
You can also make GraphQL requests:
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;