Skip to content

Commit

Permalink
Add advanced usage section for GitHub API with octokit installation i…
Browse files Browse the repository at this point in the history
…nstructions
  • Loading branch information
pelikhan committed Sep 27, 2024
1 parent b463343 commit 1e36232
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/src/content/docs/reference/scripts/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,21 @@ Gets the file content for a given ref, tag or commit sha.
const pkg = await github.getFile("package.json", "main")
console.log(pkg.content.slice(0, 50) + "...")
```

## Advanced use

You can use [octokit](https://www.npmjs.com/package/octokit) to access the full GitHub APIs.

```js
import { Octokit } from "octokit"

const info = await github.info()
const client = new Octokit(info)
...
```

You will probably need to install it in your list of packages:

```sh
npm install -D octokit
```

0 comments on commit 1e36232

Please sign in to comment.