{"id":17398440,"url":"https://github.com/vweevers/simple-octokit","last_synced_at":"2026-02-07T13:31:23.785Z","repository":{"id":40576934,"uuid":"331100672","full_name":"vweevers/simple-octokit","owner":"vweevers","description":"Preconfigured GitHub API client with GraphQL and REST.","archived":false,"fork":false,"pushed_at":"2023-04-01T05:57:01.000Z","size":213,"stargazers_count":2,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-25T01:58:22.160Z","etag":null,"topics":["github-actions","github-api","graphql","nodejs","octokit","rest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vweevers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-19T20:26:10.000Z","updated_at":"2022-03-01T09:48:08.000Z","dependencies_parsed_at":"2024-10-23T03:24:54.552Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/simple-octokit","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":"0.33333333333333337","last_synced_commit":"04e352cc944e20123bc9d95f62d42ba3db7b00cc"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fsimple-octokit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fsimple-octokit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fsimple-octokit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fsimple-octokit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/simple-octokit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251645987,"owners_count":21620847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","github-api","graphql","nodejs","octokit","rest"],"created_at":"2024-10-16T14:56:29.230Z","updated_at":"2026-02-07T13:31:23.739Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","readme":"# simple-octokit\n\n**Preconfigured GitHub API client with GraphQL and REST.** Bundles common [`@octokit`](https://github.com/octokit) plugins into a simple factory function.\n\n[![npm status](http://img.shields.io/npm/v/simple-octokit.svg)](https://www.npmjs.org/package/simple-octokit)\n[![node](https://img.shields.io/node/v/simple-octokit.svg)](https://www.npmjs.org/package/simple-octokit)\n![Test](https://github.com/vweevers/simple-octokit/workflows/Test/badge.svg?branch=main)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Table of Contents\n\n\u003cdetails\u003e\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n- [Highlights :sparkles:](#highlights-sparkles)\n- [Usage](#usage)\n- [API](#api)\n  - [`octokit = simpleOctokit([options])`](#octokit--simpleoctokitoptions)\n  - [`octokit.graphql(query[, variables])`](#octokitgraphqlquery-variables)\n  - [`octokit[scope][method]()`](#octokitscopemethod)\n  - [`octokit.request(route, options)`](#octokitrequestroute-options)\n- [Usage In Actions](#usage-in-actions)\n- [Install](#install)\n- [License](#license)\n\n\u003c/details\u003e\n\n## Highlights :sparkles:\n\n- Typical usage requires only a single option\n- Builtin retry (for network errors and rate limiting)\n- Includes [REST](https://docs.github.com/en/free-pro-team@latest/rest) (until [GraphQL](https://docs.github.com/en/free-pro-team@latest/graphql) has full coverage) with automatic pagination\n- Suitable for use in Actions like [`@actions/github`](https://github.com/actions/toolkit/tree/main/packages/github), but not only in Actions\n- Respects [`HTTP(S)_PROXY` and `NO_PROXY`](https://github.com/vweevers/auto-http-agent) (and lowercase equivalents).\n\n## Usage\n\n```js\nconst simpleOctokit = require('simple-octokit')\nconst octokit = simpleOctokit('my-github-token')\n```\n\nQuery the [GitHub GraphQL API](https://docs.github.com/en/free-pro-team@latest/graphql):\n\n```js\nconst { createIssue } = await octokit.graphql(`\n  mutation($repositoryId:ID!, $title:String!) {\n    createIssue(input: { repositoryId: $repositoryId, title: $title }) {\n      issue { number }\n    }\n  }`,\n  { repositoryId, title }\n)\n\nconsole.log(createIssue.issue.number)\n```\n\nQuery the [GitHub REST API](https://docs.github.com/en/free-pro-team@latest/rest):\n\n```js\nconst response = await octokit.issues.listForRepo({\n  owner: 'octocat',\n  repo: 'hello-world',\n  per_page: 100\n})\n\nfor (const issue of response.data) {\n  console.log(issue.number)\n}\n```\n\nThe above example only fetches the first page of 100 issues. Lazily fetch all pages using [`for await...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of):\n\n```js\nconst iterable = octokit.issues.listForRepo.all({\n  owner: 'octocat',\n  repo: 'hello-world',\n  per_page: 100\n})\n\nfor await (const response of iterable) {\n  for (const issue of response.data) {\n    console.log(issue.number)\n  }\n}\n```\n\n## API\n\n### `octokit = simpleOctokit([options])`\n\nThe `options` argument can be a string as a shorthand for `{ auth }` or an object with:\n\n- `auth` (string): personal access token, defaults to `GITHUB_TOKEN` environment variable. Can also be an object to be combined with a custom [`authStrategy`](https://github.com/octokit/core.js#options).\n- `keepAlive` (boolean): reuse connections between requests, defaults to `false`\n- `baseUrl` (string): defaults to [`GITHUB_API_URL`](https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables) environment variable or `https://api.github.com`\n- `userAgent` (string): defaults to `simple-octokit/${version}`.\n\nOther options are forwarded to [`@octokit/core`](https://github.com/octokit/core.js).\n\n### `octokit.graphql(query[, variables])`\n\nQuery the [GitHub GraphQL API](https://docs.github.com/en/free-pro-team@latest/graphql). Takes a `query` string and an optional `variables` object. Returns a promise for the query result. It's recommended to use `variables` rather than [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)  as those would make your code vulnerable to query injection attacks. The `variables` object can also contain custom request headers. For example to enable the `deletePackageVersion` mutation which is in preview at the time of writing:\n\n```js\nconst { deletePackageVersion } = await octokit.graphql(`\n  mutation ($id: String!) {\n    deletePackageVersion(input:{packageVersionId:$id}) {\n      success\n    }\n  }\n`, {\n  id,\n  headers: {\n    accept: `application/vnd.github.package-deletes-preview+json`\n  }\n})\n```\n\nSee [`@octokit/graphql`](https://github.com/octokit/graphql.js) for further details. You may also like the [Explorer](https://docs.github.com/en/free-pro-team@latest/graphql/overview/explorer). The query result displayed there is exactly what you'll get from `octokit.graphql()`.\n\n### `octokit[scope][method]()`\n\nQuery the [GitHub REST API](https://docs.github.com/en/free-pro-team@latest/rest) through a programmatic API. See [`docs`](docs/README.md) for a complete list of methods.\n\n### `octokit.request(route, options)`\n\nQuery the [GitHub REST API](https://docs.github.com/en/free-pro-team@latest/rest) through a low-level method. Returns a promise for the response. See [`@octokit/request`](https://github.com/octokit/request.js) for details. You may prefer the programmatic API above.\n\n## Usage In Actions\n\nAdd an input to your `action.yml`:\n\n```yaml\ninputs:\n  token:\n    default: ${{ github.token }}\n```\n\n```js\nconst simpleOctokit = require('simple-octokit')\nconst octokit = simpleOctokit(process.env.INPUT_TOKEN)\n```\n\nOr require consumers of your action to (more explicitly) set the token in their env:\n\n```yaml\n- uses: example-action\n  env:\n    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n```js\nconst simpleOctokit = require('simple-octokit')\nconst octokit = simpleOctokit()\n```\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install simple-octokit\n```\n\n## License\n\n[MIT](LICENSE) © Vincent Weevers\n","funding_links":[],"categories":["rest"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fsimple-octokit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fsimple-octokit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fsimple-octokit/lists"}