From 1e362321aa25e889b73a4dc16e7d5fe7a0def2da Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Fri, 27 Sep 2024 20:57:53 +0000 Subject: [PATCH] Add advanced usage section for GitHub API with octokit installation instructions --- .../content/docs/reference/scripts/github.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/src/content/docs/reference/scripts/github.md b/docs/src/content/docs/reference/scripts/github.md index 6c9f839ea9..2ae6cb9631 100644 --- a/docs/src/content/docs/reference/scripts/github.md +++ b/docs/src/content/docs/reference/scripts/github.md @@ -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 +```