{"id":13600234,"url":"https://github.com/octo-cli/octo-cli","last_synced_at":"2025-04-10T21:31:33.765Z","repository":{"id":57530535,"uuid":"154149918","full_name":"octo-cli/octo-cli","owner":"octo-cli","description":"A command line client covering 100% of GitHub's restful APIs.","archived":false,"fork":false,"pushed_at":"2020-10-16T03:28:04.000Z","size":7192,"stargazers_count":63,"open_issues_count":10,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-07T02:37:21.423Z","etag":null,"topics":["api","bash","client","github","sh","shell"],"latest_commit_sha":null,"homepage":"https://octo-cli.github.io/octo-cli","language":"Go","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/octo-cli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-22T13:34:15.000Z","updated_at":"2024-08-21T07:31:52.000Z","dependencies_parsed_at":"2022-09-14T00:11:14.831Z","dependency_job_id":null,"html_url":"https://github.com/octo-cli/octo-cli","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octo-cli%2Focto-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octo-cli%2Focto-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octo-cli%2Focto-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/octo-cli%2Focto-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/octo-cli","download_url":"https://codeload.github.com/octo-cli/octo-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248301441,"owners_count":21080893,"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":["api","bash","client","github","sh","shell"],"created_at":"2024-08-01T18:00:33.021Z","updated_at":"2025-04-10T21:31:28.745Z","avatar_url":"https://github.com/octo-cli.png","language":"Go","readme":"# octo-cli\n\n[![Stability: Experimental](https://masterminds.github.io/stability/experimental.svg)](https://masterminds.github.io/stability/experimental.html)\n\nOcto-cli is a shell client for GitHub's REST API.\n\nThink of it as [octokit](http://octokit.github.io/) for shell scripts, and you won't be far off.\n\nIf you are looking for a GitHub client to use interactively, [gh](https://cli.github.com/) should be your first choice. \n`gh` has a more refined user interface and demands at least 80% less typing in day to day use. Octo-cli wants to\n be a more convenient alternative to using raw curl commands in your shell scripts -- although if you want to go the\n curl route, check out octo-cli's `--curl` option.\n\nOcto-cli is generated from the OpenAPI spec published at https://github.com/github/rest-api-description\n\n## Walk Through\n\nA quick walk through is often the best way to get a feel for things, so here we are walking through octo-cli. This\n should cover most of what you need to get started.\n\nStart by setting the `GITHUB_TOKEN` environment variable to a personal access token for your account.\n\n```shell-session\n$ export GITHUB_TOKEN=mypersonalaccesstoken\n```\n\nNow make sure it works.\n\n```shell-session\n$ octo users get-authenticated\n{\n...\n  \"login\": \"WillAbides\",\n...\n}\n```\n\nYep. That's me.\n\nShell completions makes everything easier, so let's get that set up.\n\n```shell-session\n$ `octo --install-completions`\n$ octo \u003ctab\u003e\u003ctab\u003e\nactions               emojis                licenses              projects              search\nactivity              gists                 markdown              pulls                 teams\napps                  git                   meta                  rate-limit            users\nchecks                gitignore             migrations            reactions\ncode-scanning         interactions          oauth-authorizations  repos\ncodes-of-conduct      issues                orgs                  scim\n$ octo git \u003ctab\u003e\u003ctab\u003e\ncreate-blob         create-tag          get-blob            get-tag             update-ref\ncreate-commit       create-tree         get-commit          get-tree\ncreate-ref          delete-ref          get-ref             list-matching-refs\n```\n\nOcto has hundreds of sub commands. Shell completion is a good way to remember what's available. You may want to add \n`$(octo --install-completions)` to .bash_profile or your shell's equivalent config file.\n\nNow let's do something more fun like create a release on `octo-cli-testorg/scratch`.  First we need to figure out\n what we are releasing. Let's start by finding the latest release.\n\n```shell-session\n$ octo repos get-latest-release --repo octo-cli-testorg/scratch\n{\n  \"assets\": [],\n  \"assets_url\": \"https://api.github.com/repos/octo-cli-testorg/scratch/releases/26402951/assets\",\n  \"author\": {\n    \"avatar_url\": \"https://avatars3.githubusercontent.com/u/233500?v=4\",\n    \"events_url\": \"https://api.github.com/users/WillAbides/events{/privacy}\",\n...\n  \"tag_name\": \"v0.0.1\",\n  \"tarball_url\": \"https://api.github.com/repos/octo-cli-testorg/scratch/tarball/v0.0.1\",\n  \"target_commitish\": \"master\",\n  \"upload_url\": \"https://uploads.github.com/repos/octo-cli-testorg/scratch/releases/26402951/assets{?name,label}\",\n  \"url\": \"https://api.github.com/repos/octo-cli-testorg/scratch/releases/26402951\",\n  \"zipball_url\": \"https://api.github.com/repos/octo-cli-testorg/scratch/zipball/v0.0.1\"\n}\n```\n\nThat's right...v0.0.1. I remember it fondly. It's the release I made a few minutes ago to prep for this walk through. \nBut I just need to know the tag name, not all that other information. Let's try again using `--format` to provide a\ngo template for the output, and we'll capture it in a variable for later.\n\n```shell-session\n$ last_release_tag=\"$(octo repos get-latest-release --repo octo-cli-testorg/scratch --format {{.tag_name}})\"\n$ echo $last_release_tag\nv0.0.1\n``` \n\nWhat's changed since v0.0.1? We can check commit messages from the diff to find out.\n\n```shell-session\n$ octo repos compare-commits --repo octo-cli-testorg/scratch --base \"$last_release_tag\" --head master | jq '.commits[].commit.message'\n\"Update README.md\"\n\"add greeting capability\"\n\"Merge pull request #2 from octo-cli-testorg/greetme\\n\\nadd greeting capability\"\n```\n\nI used the `$last_release_tag` variable from earlier. I also used `jq` to process the output instead of `--format`.\n\nLet's get this new greeting capability released stat. We'll call it `v0.0.2`.\n\n```shell-session\nocto repos create-release --repo octo-cli-testorg/scratch \\\n--tag_name v0.0.2 \\\n--name \"v0.0.2 - The Greeting\" \\\n--body \"## Features\nGreeting capabilities\n\n## Chores\nUpdated README.md\n\"\n{\n  \"assets\": [],\n  \"assets_url\": \"https://api.github.com/repos/octo-cli-testorg/scratch/releases/26474415/assets\",\n...\n}\n```\n\nNice. Our release is live. We should add some binaries to it. We need to get the release id to upload assets, and I\n forgot to get that from the output before.\n \n```shell-session\n$ release_id=$(octo repos get-release-by-tag --repo octo-cli-testorg/scratch --tag v0.0.2 | jq '.id')\n$ echo $release_id\n26474415\n```\n\nI've built all the binaries, and they're in `./dist`. Now let's add them all to the release.\n\n```shell-session\nfor upload in dist/*; do\n\u003e   octo repos upload-release-asset --repo octo-cli-testorg/scratch \\\n\u003e   --release_id \"$release_id\" \\\n\u003e   --file \"$upload\" \\\n\u003e   --name \"$(echo $upload | cut -d \"/\" -f2)\" \\\n\u003e   --format \"{{.name}}\"\n\u003e done\nscratch_0.0.2_Darwin_i386.tar.gz\nscratch_0.0.2_Darwin_x86_64.tar.gz\nscratch_0.0.2_Linux_i386.tar.gz\nscratch_0.0.2_Linux_x86_64.tar.gz\nscratch_0.0.2_Windows_i386.tar.gz\nscratch_0.0.2_Windows_x86_64.tar.gz\n```\n\nWe did it! Scratch v0.0.2 is available for download.\n\n## Installation\n\n#### Homebrew\n\nTo install with [Homebrew](https://brew.sh/) on macOS or Linux:\n\n```\nbrew install octo-cli/octo/octo\n```\n\n#### The easy and overly trusting way\n\nDo you trust me? Do you even know me? Do you trust me anyway? Do you also\nhappen to have curl available on your system? I may have the answer for you.\n\nJust run the following command to download octo to your current directory:\n\n```\ncurl https://raw.githubusercontent.com/octo-cli/octo-cli/main/download.sh | sh\n```\n\n#### The slightly harder and slightly less trusting way\n\nGo to the [latest release](https://github.com/octo-cli/octo-cli/releases/latest), download\nthe archive for your operating system and architecture (if you don't know your\narchitecture it's probably `x86_64`). Extract the archive using `tar -xzf` or\nequivalent.\n\n#### The least trusting way\n\nI get it. You don't trust me. I wouldn't trust me either. If you have golang\non your system you can install from source cloning this repo and running\n`script/build`.  This will create `bin/octo`.  You could also run\n`go install github.com/octo-cli/octo-cli`. This will install `octo-cli`\nfor you. Note that the binary will be named `octo-cli` instead of `octo`.\nYou can rename it if you want.\n\n#### Scoop and Snapcraft\n\nWouldn't it be cool if you could install with scoop or snapcraft?\nI think so, but haven't spent the time to set this up yet. If you have the\nknow-how and time to spare, we could [use your help](https://github.com/octo-cli/octo-cli/issues/90).\n\n## Help\n\nLike many command line utilities, you can get context sensitive help with `--help`. Unlike them, the help in octo-cli\nis generated from api documentation. That means some of the wording doesn't quite fit in a command line context.\n\n## Untested commands\n\nBecause octo-cli is automatically generated and covers so many endpoints, \nmost of the commands haven't been tested or even run. If you run into a\nproblem with a command, please create an issue.\n\n## Credentials\n\nOcto-cli looks for a personal access token in the `GITHUB_TOKEN` environment variable.\n\nThat is the only form of authentication that is currently available. Unfortunately this means that authenticating as\n a GitHub App is not possible for now.\n\n## GitHub Enterprise Server\n\nUse octo-cli with GitHub enterprise by setting the environment variable\nGITHUB_API_BASE_URL. Something like `export GITHUB_API_BASE_URL=https://ghe.example.com/api/v3`.\nYou can also set this with a flag on each command: `--api-base-url=\"https://ghe.example.com/api/v3\"`.\n\n## Curl\n\nOcto-cli provides a `--curl` flag that causes it to output a curl request. This could be useful if you want to use\n octo-cli to build a request but can't or don't want to include octo-cli in your project.\n \n```shell-session\n$ octo repos create-release --repo foo/bar --tag_name v0.0.1 --name \"my release\" --draft --curl\n\ncurl -X 'POST' -d '{\"draft\":true,\"name\":\"my release\",\"tag_name\":\"v0.0.1\"}' -H 'Accept: application/vnd.github.v3+json' \n-H 'Content-Type: application/json' -H 'User-Agent: octo-cli/0.11.0' -H \"Authorization: token $GITHUB_TOKEN\" \n'https://api.github.com/repos/foo/bar/releases'\n```\n\n## Output\n\n__See [Formatting Output](docs/format.md)__\n\nOcto-cli outputs prettified json. You can modify the output with `--format`, `--output-each` and \n`--raw-output` flags. \n\n## Preview flags\n\nGitHub uses [preview flags](https://developer.github.com/v3/previews/) when\nintroducing API changes. These require you to send a preview header when\nsubmitting a request. Octo-cli will not set these headers automatically.\nInstead it provides flags for you to enable the relevant previews for each\ncommand.\n\nThe decision to not automatically set preview headers is intended to prevent\nusers from unknowingly becoming reliant on APIs that are subject to change.\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focto-cli%2Focto-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focto-cli%2Focto-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focto-cli%2Focto-cli/lists"}