repos: 207052882
This data as json
id | node_id | name | full_name | private | owner | html_url | description | fork | created_at | updated_at | pushed_at | homepage | size | stargazers_count | watchers_count | language | has_issues | has_projects | has_downloads | has_wiki | has_pages | forks_count | archived | disabled | open_issues_count | license | topics | forks | open_issues | watchers | default_branch | permissions | temp_clone_token | organization | network_count | subscribers_count | readme | readme_html | allow_forking | visibility | is_template | template_repository | web_commit_signoff_required | has_discussions |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
207052882 | MDEwOlJlcG9zaXRvcnkyMDcwNTI4ODI= | github-to-sqlite | dogsheep/github-to-sqlite | 0 | 53015001 | https://github.com/dogsheep/github-to-sqlite | Save data from GitHub to a SQLite database | 0 | 2019-09-08T02:50:28Z | 2022-09-20T04:36:37Z | 2022-09-28T21:07:54Z | https://github-to-sqlite.dogsheep.net/ | 143 | 235 | 235 | Python | 1 | 1 | 1 | 1 | 0 | 32 | 0 | 0 | 20 | apache-2.0 | ["datasette", "datasette-io", "datasette-tool", "dogsheep", "github-api", "sqlite"] | 32 | 20 | 235 | main | {"admin": false, "maintain": false, "push": false, "triage": false, "pull": false} | 53015001 | 32 | 6 | # github-to-sqlite [](https://pypi.org/project/github-to-sqlite/) [](https://github.com/dogsheep/github-to-sqlite/releases) [](https://github.com/dogsheep/github-to-sqlite/actions?query=workflow%3ATest) [](https://github.com/dogsheep/github-to-sqlite/blob/main/LICENSE) Save data from GitHub to a SQLite database. <!-- toc --> - [Demo](#demo) - [How to install](#how-to-install) - [Authentication](#authentication) - [Fetching issues for a repository](#fetching-issues-for-a-repository) - [Fetching pull requests for a repository](#fetching-pull-requests-for-a-repository) - [Fetching issue comments for a repository](#fetching-issue-comments-for-a-repository) - [Fetching commits for a repository](#fetching-commits-for-a-repository) - [Fetching releases for a repository](#fetching-releases-for-a-repository) - [Fetching tags for a repository](#fetching-tags-for-a-repository) - [Fetching contributors to a repository](#fetching-contributors-to-a-repository) - [Fetching repos belonging to a user or organization](#fetching-repos-belonging-to-a-user-or-organization) - [Fetching specific repositories](#fetching-specific-repositories) - [Fetching repos that have been starred by a user](#fetching-repos-that-have-been-starred-by-a-user) - [Fetching users that have starred specific repos](#fetching-users-that-have-starred-specific-repos) - [Fetching GitHub Actions workflows](#fetching-github-actions-workflows) - [Scraping dependents for a repository](#scraping-dependents-for-a-repository) - [Fetching emojis](#fetching-emojis) - [Making authenticated API calls](#making-authenticated-api-calls) <!-- tocstop --> ## Demo https://github-to-sqlite.dogsheep.net/ hosts a [Datasette](https://datasette.io/) demo of a database created by [running this tool](https://github.com/dogsheep/github-to-sqlite/blob/main/.github/workflows/deploy-demo.yml#L40-L60) against all of the repositories in the [Dogsheep GitHub organization](https://github.com/dogsheep), plus the [datasette](https://github.com/simonw/datasette) and [sqlite-utils](https://github.com/simonw/sqlite-utils) repositories. ## How to install $ pip install github-to-sqlite ## Authentication Create a GitHub personal access token: https://github.com/settings/tokens Run this command and paste in your new token: $ github-to-sqlite auth This will create a file called `auth.json` in your current directory containing the required value. To save the file at a different path or filename, use the `--auth=myauth.json` option. As an alternative to using an `auth.json` file you can add your access token to an environment variable called `GITHUB_TOKEN`. ## Fetching issues for a repository The `issues` command retrieves all of the issues belonging to a specified repository. $ github-to-sqlite issues github.db simonw/datasette If an `auth.json` file is present it will use the token from that file. It works without authentication for public repositories but you should be aware that GitHub have strict IP-based rate limits for unauthenticated requests. You can point to a different location of `auth.json` using `-a`: $ github-to-sqlite issues github.db simonw/datasette -a /path/to/auth.json You can use the `--issue` option one or more times to load specific issues: $ github-to-sqlite issues github.db simonw/datasette --issue=1 Example: [issues table](https://github-to-sqlite.dogsheep.net/github/issues) ## Fetching pull requests for a repository While pull requests are a type of issue, you will get more information on pull requests by pulling them separately. For example, whether a pull request has been merged and when. Following the API of issues, the `pull-requests` command retrieves all of the pull requests belonging to a specified repository. $ github-to-sqlite pull-requests github.db simonw/datasette You can use the `--pull-request` option one or more times to load specific pull request: $ github-to-sqlite pull-requests github.db simonw/datasette --pull-request=81 Note that the `merged_by` column on the `pull_requests` table will only be populated for pull requests that are loaded using the `--pull-request` option - the GitHub API does not return this field for pull requests that are loaded in bulk. Example: [pull_requests table](https://github-to-sqlite.dogsheep.net/github/pull_requests) ## Fetching issue comments for a repository The `issue-comments` command retrieves all of the comments on all of the issues in a repository. It is recommended you run `issues` first, so that each imported comment can have a foreign key poining to its issue. $ github-to-sqlite issues github.db simonw/datasette $ github-to-sqlite issue-comments github.db simonw/datasette You can use the `--issue` option to only load comments for a specific issue within that repository, for example: $ github-to-sqlite issue-comments github.db simonw/datasette --issue=1 Example: [issue_comments table](https://github-to-sqlite.dogsheep.net/github/issue_comments) ## Fetching commits for a repository The `commits` command retrieves details of all of the commits for one or more repositories. It currently fetches the sha, commit message and author and committer details - it does no retrieve the full commit body. $ github-to-sqlite commits github.db simonw/datasette simonw/sqlite-utils The command accepts one or more repositories. By default it will stop as soon as it sees a commit that has previously been retrieved. You can force it to retrieve all commits (including those that have been previously inserted) using `--all`. Example: [commits table](https://github-to-sqlite.dogsheep.net/github/commits) ## Fetching releases for a repository The `releases` command retrieves the releases for one or more repositories. $ github-to-sqlite releases github.db simonw/datasette simonw/sqlite-utils The command accepts one or more repositories. Example: [releases table](https://github-to-sqlite.dogsheep.net/github/releases) ## Fetching tags for a repository The `tags` command retrieves all of the tags for one or more repositories. $ github-to-sqlite tags github.db simonw/datasette simonw/sqlite-utils Example: [tags table](https://github-to-sqlite.dogsheep.net/github/tags) ## Fetching contributors to a repository The `contributors` command retrieves details of all of the contributors for one or more repositories. $ github-to-sqlite contributors github.db simonw/datasette simonw/sqlite-utils The command accepts one or more repositories. It populates a `contributors` table, with foreign keys to `repos` and `users` and a `contributions` table listing the number of commits to that repository for each contributor. Example: [contributors table](https://github-to-sqlite.dogsheep.net/github/contributors) ## Fetching repos belonging to a user or organization The `repos` command fetches repos belonging to a user or organization. Without any other arguments, this command will fetch all repos that the currently authenticated user owns, collaborates on or can access via one of their organizations: $ github-to-sqlite repos github.db To fetch repos belonging to a specific user or organization, provide their username as an argument: $ github-to-sqlite repos github.db dogsheep # organization $ github-to-sqlite repos github.db simonw # user You can pass more than one username to fetch for multiple users or organizations at once: $ github-to-sqlite repos github.db simonw dogsheep Add the `--readme` option to save the README for the repo in a column called `readme`. Add `--readme-html` to save the HTML rendered version of the README into a collumn called `readme_html`. Example: [repos table](https://github-to-sqlite.dogsheep.net/github/repos) ## Fetching specific repositories You can use `-r` with the `repos` command one or more times to fetch just specific repositories. $ github-to-sqlite repos github.db -r simonw/datasette -r dogsheep/github-to-sqlite ## Fetching repos that have been starred by a user The `starred` command fetches the repos that have been starred by a user. $ github-to-sqlite starred github.db simonw If you are using an `auth.json` file you can omit the username to retrieve the starred repos for the authenticated user. Example: [stars table](https://github-to-sqlite.dogsheep.net/github/stars) ## Fetching users that have starred specific repos The `stargazers` command fetches the users that have starred the specified repos. $ github-to-sqlite stargazers github.db simonw/datasette dogsheep/github-to-sqlite You can specify one or more repository using `owner/repo` syntax. Users fetched using this command will be inserted into the `users` table. Many-to-many records showing which repository they starred will be added to the `stars` table. ## Fetching GitHub Actions workflows The `workflows` command fetches the YAML workflow configurations from each repository's `.github/workflows` directory and parses them to populate `workflows`, `jobs` and `steps` tables. $ github-to-sqlite workflows github.db simonw/datasette dogsheep/github-to-sqlite You can specify one or more repository using `owner/repo` syntax. Example: [workflows table](https://github-to-sqlite.dogsheep.net/github/workflows), [jobs table](https://github-to-sqlite.dogsheep.net/github/jobs), [steps table](https://github-to-sqlite.dogsheep.net/github/steps) ## Scraping dependents for a repository The GitHub dependency graph can show other GitHub projects that depend on a specific repo, for example [simonw/datasette/network/dependents](https://github.com/simonw/datasette/network/dependents). This data is not yet available through the GitHub API. The `scrape-dependents` command scrapes those pages and uses the GitHub API to load full versions of the dependent repositories. $ github-to-sqlite scrape-dependents github.db simonw/datasette The command accepts one or more repositories. Add `-v` for verbose output. Example: [dependents table](https://github-to-sqlite.dogsheep.net/github/dependents?_sort_desc=first_seen_utc) ## Fetching emojis You can fetch a list of every emoji supported by GitHub using the `emojis` command: $ github-to-sqlite emojis github.db This will create a table callad `emojis` with a primary key `name` and a `url` column. If you add the `--fetch` option the command will also fetch the binary content of the images and place them in an `image` column: $ github-to-sqlite emojis emojis.db -f [########----------------------------] 397/1799 22% 00:03:43 You can then use the [datasette-render-images](https://github.com/simonw/datasette-render-images) plugin to browse them visually. Example: [emojis table](https://github-to-sqlite.dogsheep.net/github/emojis) ## Making authenticated API calls The `github-to-sqlite get` command provides a convenient shortcut for making authenticated calls to the API. Once you have created your `auth.json` file (or set a `GITHUB_TOKEN` environment variable) you can use it like this: $ github-to-sqlite get https://api.github.com/gists This will make an authenticated call to the URL you provide and pretty-print the resulting JSON to the console. You can ommit the `https://api.github.com/` prefix, for example: $ github-to-sqlite get /gists Many GitHub APIs are [paginated using the HTTP Link header](https://docs.github.com/en/rest/guides/traversing-with-pagination). You can follow this pagination and output a list of all of the resulting items using `--paginate`: $ github-to-sqlite get /users/simonw/repos --paginate You can outline newline-delimited JSON for each item using `--nl`. This can be useful for streaming items into another tool. $ github-to-sqlite get /users/simonw/repos --nl | <div id="readme" class="md" data-path="README.md"><article class="markdown-body entry-content container-lg" itemprop="text"><h1 dir="auto"><a id="user-content-github-to-sqlite" class="anchor" aria-hidden="true" href="#user-content-github-to-sqlite"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>github-to-sqlite</h1> <p dir="auto"><a href="https://pypi.org/project/github-to-sqlite/" rel="nofollow"><img src="https://camo.githubusercontent.com/515e6efa4aef15e83b08072e5490c9040420223b2355d1d715cb628f66d60dff/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f6769746875622d746f2d73716c6974652e737667" alt="PyPI" data-canonical-src="https://img.shields.io/pypi/v/github-to-sqlite.svg" style="max-width: 100%;"></a> <a href="https://github.com/dogsheep/github-to-sqlite/releases"><img src="https://camo.githubusercontent.com/ae3fbf680cae0fca1e9126549e1fd0e14e756f6f77046e878db7b1c9cbd78911/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f646f6773686565702f6769746875622d746f2d73716c6974653f696e636c7564655f70726572656c6561736573266c6162656c3d6368616e67656c6f67" alt="Changelog" data-canonical-src="https://img.shields.io/github/v/release/dogsheep/github-to-sqlite?include_prereleases&label=changelog" style="max-width: 100%;"></a> <a href="https://github.com/dogsheep/github-to-sqlite/actions?query=workflow%3ATest"><img src="https://github.com/dogsheep/github-to-sqlite/workflows/Test/badge.svg" alt="Tests" style="max-width: 100%;"></a> <a href="https://github.com/dogsheep/github-to-sqlite/blob/main/LICENSE"><img src="https://camo.githubusercontent.com/1698104e976c681143eb0841f9675c6f802bb7aa832afc0c7a4e719b1f3cf955/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d626c75652e737667" alt="License" data-canonical-src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" style="max-width: 100%;"></a></p> <p dir="auto">Save data from GitHub to a SQLite database.</p> <ul dir="auto"> <li><a href="#user-content-demo">Demo</a></li> <li><a href="#user-content-how-to-install">How to install</a></li> <li><a href="#user-content-authentication">Authentication</a></li> <li><a href="#user-content-fetching-issues-for-a-repository">Fetching issues for a repository</a></li> <li><a href="#user-content-fetching-pull-requests-for-a-repository">Fetching pull requests for a repository</a></li> <li><a href="#user-content-fetching-issue-comments-for-a-repository">Fetching issue comments for a repository</a></li> <li><a href="#user-content-fetching-commits-for-a-repository">Fetching commits for a repository</a></li> <li><a href="#user-content-fetching-releases-for-a-repository">Fetching releases for a repository</a></li> <li><a href="#user-content-fetching-tags-for-a-repository">Fetching tags for a repository</a></li> <li><a href="#user-content-fetching-contributors-to-a-repository">Fetching contributors to a repository</a></li> <li><a href="#user-content-fetching-repos-belonging-to-a-user-or-organization">Fetching repos belonging to a user or organization</a></li> <li><a href="#user-content-fetching-specific-repositories">Fetching specific repositories</a></li> <li><a href="#user-content-fetching-repos-that-have-been-starred-by-a-user">Fetching repos that have been starred by a user</a></li> <li><a href="#user-content-fetching-users-that-have-starred-specific-repos">Fetching users that have starred specific repos</a></li> <li><a href="#user-content-fetching-github-actions-workflows">Fetching GitHub Actions workflows</a></li> <li><a href="#user-content-scraping-dependents-for-a-repository">Scraping dependents for a repository</a></li> <li><a href="#user-content-fetching-emojis">Fetching emojis</a></li> <li><a href="#user-content-making-authenticated-api-calls">Making authenticated API calls</a></li> </ul> <h2 dir="auto"><a id="user-content-demo" class="anchor" aria-hidden="true" href="#user-content-demo"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Demo</h2> <p dir="auto"><a href="https://github-to-sqlite.dogsheep.net/" rel="nofollow">https://github-to-sqlite.dogsheep.net/</a> hosts a <a href="https://datasette.io/" rel="nofollow">Datasette</a> demo of a database created by <a href="https://github.com/dogsheep/github-to-sqlite/blob/main/.github/workflows/deploy-demo.yml#L40-L60">running this tool</a> against all of the repositories in the <a href="https://github.com/dogsheep">Dogsheep GitHub organization</a>, plus the <a href="https://github.com/simonw/datasette">datasette</a> and <a href="https://github.com/simonw/sqlite-utils">sqlite-utils</a> repositories.</p> <h2 dir="auto"><a id="user-content-how-to-install" class="anchor" aria-hidden="true" href="#user-content-how-to-install"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>How to install</h2> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ pip install github-to-sqlite"><pre class="notranslate"><code>$ pip install github-to-sqlite </code></pre></div> <h2 dir="auto"><a id="user-content-authentication" class="anchor" aria-hidden="true" href="#user-content-authentication"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Authentication</h2> <p dir="auto">Create a GitHub personal access token: <a href="https://github.com/settings/tokens">https://github.com/settings/tokens</a></p> <p dir="auto">Run this command and paste in your new token:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite auth"><pre class="notranslate"><code>$ github-to-sqlite auth </code></pre></div> <p dir="auto">This will create a file called <code>auth.json</code> in your current directory containing the required value. To save the file at a different path or filename, use the <code>--auth=myauth.json</code> option.</p> <p dir="auto">As an alternative to using an <code>auth.json</code> file you can add your access token to an environment variable called <code>GITHUB_TOKEN</code>.</p> <h2 dir="auto"><a id="user-content-fetching-issues-for-a-repository" class="anchor" aria-hidden="true" href="#user-content-fetching-issues-for-a-repository"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching issues for a repository</h2> <p dir="auto">The <code>issues</code> command retrieves all of the issues belonging to a specified repository.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite issues github.db simonw/datasette"><pre class="notranslate"><code>$ github-to-sqlite issues github.db simonw/datasette </code></pre></div> <p dir="auto">If an <code>auth.json</code> file is present it will use the token from that file. It works without authentication for public repositories but you should be aware that GitHub have strict IP-based rate limits for unauthenticated requests.</p> <p dir="auto">You can point to a different location of <code>auth.json</code> using <code>-a</code>:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite issues github.db simonw/datasette -a /path/to/auth.json"><pre class="notranslate"><code>$ github-to-sqlite issues github.db simonw/datasette -a /path/to/auth.json </code></pre></div> <p dir="auto">You can use the <code>--issue</code> option one or more times to load specific issues:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite issues github.db simonw/datasette --issue=1"><pre class="notranslate"><code>$ github-to-sqlite issues github.db simonw/datasette --issue=1 </code></pre></div> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/issues" rel="nofollow">issues table</a></p> <h2 dir="auto"><a id="user-content-fetching-pull-requests-for-a-repository" class="anchor" aria-hidden="true" href="#user-content-fetching-pull-requests-for-a-repository"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching pull requests for a repository</h2> <p dir="auto">While pull requests are a type of issue, you will get more information on pull requests by pulling them separately. For example, whether a pull request has been merged and when.</p> <p dir="auto">Following the API of issues, the <code>pull-requests</code> command retrieves all of the pull requests belonging to a specified repository.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite pull-requests github.db simonw/datasette"><pre class="notranslate"><code>$ github-to-sqlite pull-requests github.db simonw/datasette </code></pre></div> <p dir="auto">You can use the <code>--pull-request</code> option one or more times to load specific pull request:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite pull-requests github.db simonw/datasette --pull-request=81"><pre class="notranslate"><code>$ github-to-sqlite pull-requests github.db simonw/datasette --pull-request=81 </code></pre></div> <p dir="auto">Note that the <code>merged_by</code> column on the <code>pull_requests</code> table will only be populated for pull requests that are loaded using the <code>--pull-request</code> option - the GitHub API does not return this field for pull requests that are loaded in bulk.</p> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/pull_requests" rel="nofollow">pull_requests table</a></p> <h2 dir="auto"><a id="user-content-fetching-issue-comments-for-a-repository" class="anchor" aria-hidden="true" href="#user-content-fetching-issue-comments-for-a-repository"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching issue comments for a repository</h2> <p dir="auto">The <code>issue-comments</code> command retrieves all of the comments on all of the issues in a repository.</p> <p dir="auto">It is recommended you run <code>issues</code> first, so that each imported comment can have a foreign key poining to its issue.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite issues github.db simonw/datasette $ github-to-sqlite issue-comments github.db simonw/datasette"><pre class="notranslate"><code>$ github-to-sqlite issues github.db simonw/datasette $ github-to-sqlite issue-comments github.db simonw/datasette </code></pre></div> <p dir="auto">You can use the <code>--issue</code> option to only load comments for a specific issue within that repository, for example:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite issue-comments github.db simonw/datasette --issue=1"><pre class="notranslate"><code>$ github-to-sqlite issue-comments github.db simonw/datasette --issue=1 </code></pre></div> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/issue_comments" rel="nofollow">issue_comments table</a></p> <h2 dir="auto"><a id="user-content-fetching-commits-for-a-repository" class="anchor" aria-hidden="true" href="#user-content-fetching-commits-for-a-repository"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching commits for a repository</h2> <p dir="auto">The <code>commits</code> command retrieves details of all of the commits for one or more repositories. It currently fetches the sha, commit message and author and committer details - it does no retrieve the full commit body.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite commits github.db simonw/datasette simonw/sqlite-utils"><pre class="notranslate"><code>$ github-to-sqlite commits github.db simonw/datasette simonw/sqlite-utils </code></pre></div> <p dir="auto">The command accepts one or more repositories.</p> <p dir="auto">By default it will stop as soon as it sees a commit that has previously been retrieved. You can force it to retrieve all commits (including those that have been previously inserted) using <code>--all</code>.</p> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/commits" rel="nofollow">commits table</a></p> <h2 dir="auto"><a id="user-content-fetching-releases-for-a-repository" class="anchor" aria-hidden="true" href="#user-content-fetching-releases-for-a-repository"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching releases for a repository</h2> <p dir="auto">The <code>releases</code> command retrieves the releases for one or more repositories.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite releases github.db simonw/datasette simonw/sqlite-utils"><pre class="notranslate"><code>$ github-to-sqlite releases github.db simonw/datasette simonw/sqlite-utils </code></pre></div> <p dir="auto">The command accepts one or more repositories.</p> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/releases" rel="nofollow">releases table</a></p> <h2 dir="auto"><a id="user-content-fetching-tags-for-a-repository" class="anchor" aria-hidden="true" href="#user-content-fetching-tags-for-a-repository"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching tags for a repository</h2> <p dir="auto">The <code>tags</code> command retrieves all of the tags for one or more repositories.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite tags github.db simonw/datasette simonw/sqlite-utils"><pre class="notranslate"><code>$ github-to-sqlite tags github.db simonw/datasette simonw/sqlite-utils </code></pre></div> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/tags" rel="nofollow">tags table</a></p> <h2 dir="auto"><a id="user-content-fetching-contributors-to-a-repository" class="anchor" aria-hidden="true" href="#user-content-fetching-contributors-to-a-repository"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching contributors to a repository</h2> <p dir="auto">The <code>contributors</code> command retrieves details of all of the contributors for one or more repositories.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite contributors github.db simonw/datasette simonw/sqlite-utils"><pre class="notranslate"><code>$ github-to-sqlite contributors github.db simonw/datasette simonw/sqlite-utils </code></pre></div> <p dir="auto">The command accepts one or more repositories. It populates a <code>contributors</code> table, with foreign keys to <code>repos</code> and <code>users</code> and a <code>contributions</code> table listing the number of commits to that repository for each contributor.</p> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/contributors" rel="nofollow">contributors table</a></p> <h2 dir="auto"><a id="user-content-fetching-repos-belonging-to-a-user-or-organization" class="anchor" aria-hidden="true" href="#user-content-fetching-repos-belonging-to-a-user-or-organization"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching repos belonging to a user or organization</h2> <p dir="auto">The <code>repos</code> command fetches repos belonging to a user or organization.</p> <p dir="auto">Without any other arguments, this command will fetch all repos that the currently authenticated user owns, collaborates on or can access via one of their organizations:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite repos github.db"><pre class="notranslate"><code>$ github-to-sqlite repos github.db </code></pre></div> <p dir="auto">To fetch repos belonging to a specific user or organization, provide their username as an argument:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite repos github.db dogsheep # organization $ github-to-sqlite repos github.db simonw # user"><pre class="notranslate"><code>$ github-to-sqlite repos github.db dogsheep # organization $ github-to-sqlite repos github.db simonw # user </code></pre></div> <p dir="auto">You can pass more than one username to fetch for multiple users or organizations at once:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite repos github.db simonw dogsheep"><pre class="notranslate"><code>$ github-to-sqlite repos github.db simonw dogsheep </code></pre></div> <p dir="auto">Add the <code>--readme</code> option to save the README for the repo in a column called <code>readme</code>. Add <code>--readme-html</code> to save the HTML rendered version of the README into a collumn called <code>readme_html</code>.</p> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/repos" rel="nofollow">repos table</a></p> <h2 dir="auto"><a id="user-content-fetching-specific-repositories" class="anchor" aria-hidden="true" href="#user-content-fetching-specific-repositories"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching specific repositories</h2> <p dir="auto">You can use <code>-r</code> with the <code>repos</code> command one or more times to fetch just specific repositories.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite repos github.db -r simonw/datasette -r dogsheep/github-to-sqlite"><pre class="notranslate"><code>$ github-to-sqlite repos github.db -r simonw/datasette -r dogsheep/github-to-sqlite </code></pre></div> <h2 dir="auto"><a id="user-content-fetching-repos-that-have-been-starred-by-a-user" class="anchor" aria-hidden="true" href="#user-content-fetching-repos-that-have-been-starred-by-a-user"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching repos that have been starred by a user</h2> <p dir="auto">The <code>starred</code> command fetches the repos that have been starred by a user.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite starred github.db simonw"><pre class="notranslate"><code>$ github-to-sqlite starred github.db simonw </code></pre></div> <p dir="auto">If you are using an <code>auth.json</code> file you can omit the username to retrieve the starred repos for the authenticated user.</p> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/stars" rel="nofollow">stars table</a></p> <h2 dir="auto"><a id="user-content-fetching-users-that-have-starred-specific-repos" class="anchor" aria-hidden="true" href="#user-content-fetching-users-that-have-starred-specific-repos"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching users that have starred specific repos</h2> <p dir="auto">The <code>stargazers</code> command fetches the users that have starred the specified repos.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite stargazers github.db simonw/datasette dogsheep/github-to-sqlite"><pre class="notranslate"><code>$ github-to-sqlite stargazers github.db simonw/datasette dogsheep/github-to-sqlite </code></pre></div> <p dir="auto">You can specify one or more repository using <code>owner/repo</code> syntax.</p> <p dir="auto">Users fetched using this command will be inserted into the <code>users</code> table. Many-to-many records showing which repository they starred will be added to the <code>stars</code> table.</p> <h2 dir="auto"><a id="user-content-fetching-github-actions-workflows" class="anchor" aria-hidden="true" href="#user-content-fetching-github-actions-workflows"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching GitHub Actions workflows</h2> <p dir="auto">The <code>workflows</code> command fetches the YAML workflow configurations from each repository's <code>.github/workflows</code> directory and parses them to populate <code>workflows</code>, <code>jobs</code> and <code>steps</code> tables.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite workflows github.db simonw/datasette dogsheep/github-to-sqlite"><pre class="notranslate"><code>$ github-to-sqlite workflows github.db simonw/datasette dogsheep/github-to-sqlite </code></pre></div> <p dir="auto">You can specify one or more repository using <code>owner/repo</code> syntax.</p> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/workflows" rel="nofollow">workflows table</a>, <a href="https://github-to-sqlite.dogsheep.net/github/jobs" rel="nofollow">jobs table</a>, <a href="https://github-to-sqlite.dogsheep.net/github/steps" rel="nofollow">steps table</a></p> <h2 dir="auto"><a id="user-content-scraping-dependents-for-a-repository" class="anchor" aria-hidden="true" href="#user-content-scraping-dependents-for-a-repository"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Scraping dependents for a repository</h2> <p dir="auto">The GitHub dependency graph can show other GitHub projects that depend on a specific repo, for example <a href="https://github.com/simonw/datasette/network/dependents">simonw/datasette/network/dependents</a>.</p> <p dir="auto">This data is not yet available through the GitHub API. The <code>scrape-dependents</code> command scrapes those pages and uses the GitHub API to load full versions of the dependent repositories.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite scrape-dependents github.db simonw/datasette"><pre class="notranslate"><code>$ github-to-sqlite scrape-dependents github.db simonw/datasette </code></pre></div> <p dir="auto">The command accepts one or more repositories.</p> <p dir="auto">Add <code>-v</code> for verbose output.</p> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/dependents?_sort_desc=first_seen_utc" rel="nofollow">dependents table</a></p> <h2 dir="auto"><a id="user-content-fetching-emojis" class="anchor" aria-hidden="true" href="#user-content-fetching-emojis"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Fetching emojis</h2> <p dir="auto">You can fetch a list of every emoji supported by GitHub using the <code>emojis</code> command:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite emojis github.db"><pre class="notranslate"><code>$ github-to-sqlite emojis github.db </code></pre></div> <p dir="auto">This will create a table callad <code>emojis</code> with a primary key <code>name</code> and a <code>url</code> column.</p> <p dir="auto">If you add the <code>--fetch</code> option the command will also fetch the binary content of the images and place them in an <code>image</code> column:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite emojis emojis.db -f [########----------------------------] 397/1799 22% 00:03:43"><pre class="notranslate"><code>$ github-to-sqlite emojis emojis.db -f [########----------------------------] 397/1799 22% 00:03:43 </code></pre></div> <p dir="auto">You can then use the <a href="https://github.com/simonw/datasette-render-images">datasette-render-images</a> plugin to browse them visually.</p> <p dir="auto">Example: <a href="https://github-to-sqlite.dogsheep.net/github/emojis" rel="nofollow">emojis table</a></p> <h2 dir="auto"><a id="user-content-making-authenticated-api-calls" class="anchor" aria-hidden="true" href="#user-content-making-authenticated-api-calls"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Making authenticated API calls</h2> <p dir="auto">The <code>github-to-sqlite get</code> command provides a convenient shortcut for making authenticated calls to the API. Once you have created your <code>auth.json</code> file (or set a <code>GITHUB_TOKEN</code> environment variable) you can use it like this:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite get https://api.github.com/gists"><pre class="notranslate"><code>$ github-to-sqlite get https://api.github.com/gists </code></pre></div> <p dir="auto">This will make an authenticated call to the URL you provide and pretty-print the resulting JSON to the console.</p> <p dir="auto">You can ommit the <code>https://api.github.com/</code> prefix, for example:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite get /gists"><pre class="notranslate"><code>$ github-to-sqlite get /gists </code></pre></div> <p dir="auto">Many GitHub APIs are <a href="https://docs.github.com/en/rest/guides/traversing-with-pagination">paginated using the HTTP Link header</a>. You can follow this pagination and output a list of all of the resulting items using <code>--paginate</code>:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite get /users/simonw/repos --paginate"><pre class="notranslate"><code>$ github-to-sqlite get /users/simonw/repos --paginate </code></pre></div> <p dir="auto">You can outline newline-delimited JSON for each item using <code>--nl</code>. This can be useful for streaming items into another tool.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ github-to-sqlite get /users/simonw/repos --nl"><pre class="notranslate"><code>$ github-to-sqlite get /users/simonw/repos --nl </code></pre></div> </article></div> | 1 | public | 0 | 0 |
Links from other tables
- 22 rows from repo in releases