About Octokit.js
If you want to write a script using JavaScript to interact with GitHub's REST API, GitHub recommends that you use the Octokit.js SDK. Octokit.js is maintained by GitHub. The SDK implements best practices and makes it easier for you to interact with the REST API via JavaScript. Octokit.js works with all modern browsers, Node.js, and Deno. For more information about Octokit.js, see the Octokit.js README.
Prerequisites
This guide assumes that you are familiar with JavaScript and the GitHub REST API. For more information about the REST API, see "Getting started with the REST API."
You must install and import octokit in order to use the Octokit.js library. This guide uses import statements in accordance with ES6. For more information about different installation and import methods, see the Octokit.js README's Usage section.
Instantiating and authenticating
Warning: Treat your authentication credentials like a password.
To keep your credentials secure, you can store your credentials as a secret and run your script through GitHub Actions. For more information, see "Encrypted secrets."
If this is not possible, consider using another service such as the 1Password CLI to store your credentials securely.
Authenticating with a personal access token
If you want to use the GitHub REST API for personal use, you can create a personal access token. For more information about creating a personal access token, see "Creating a personal access token."
First, import Octokit from octokit. Then, pass your personal access token when you create an instance of Octokit. In the following example, replace