From aec0ef46e45dcf0af6921b74d2c0abe2ee9d998b Mon Sep 17 00:00:00 2001 From: Gregor Martynus Date: Wed, 7 Aug 2019 14:23:44 -0700 Subject: [PATCH] [@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 --- packages/github/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/github/README.md b/packages/github/README.md index 60b5307f..2b74bb1d 100644 --- a/packages/github/README.md +++ b/packages/github/README.md @@ -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;