{"id":42423752,"url":"https://github.com/jordanblakey/gh-scripting","last_synced_at":"2026-01-28T03:05:44.688Z","repository":{"id":295686244,"uuid":"990903757","full_name":"jordanblakey/gh-scripting","owner":"jordanblakey","description":"Experiments in working with Github through the CLI.","archived":false,"fork":false,"pushed_at":"2025-06-07T17:49:58.000Z","size":20,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-07T18:29:30.470Z","etag":null,"topics":["automation","github"],"latest_commit_sha":null,"homepage":"github.com/jordanblakey/gh-scripting","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jordanblakey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-05-26T20:28:11.000Z","updated_at":"2025-06-07T17:50:01.000Z","dependencies_parsed_at":"2025-05-26T21:38:49.738Z","dependency_job_id":"b73f89e9-231a-47af-a410-2a1e1d1612f8","html_url":"https://github.com/jordanblakey/gh-scripting","commit_stats":null,"previous_names":["jordanblakey/gh-scripting"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jordanblakey/gh-scripting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jordanblakey%2Fgh-scripting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jordanblakey%2Fgh-scripting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jordanblakey%2Fgh-scripting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jordanblakey%2Fgh-scripting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jordanblakey","download_url":"https://codeload.github.com/jordanblakey/gh-scripting/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jordanblakey%2Fgh-scripting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28835927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T02:10:51.810Z","status":"ssl_error","status_checked_at":"2026-01-28T02:10:50.806Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["automation","github"],"created_at":"2026-01-28T03:05:44.598Z","updated_at":"2026-01-28T03:05:44.676Z","avatar_url":"https://github.com/jordanblakey.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `gh` Scripting\n\nExperiments in working with Github through the CLI.\n\nRelated: see Github Actions experimentation around docker containers here\nhttps://github.com/jordanblakey/docker-in-depth\n\n```sh\n# will use often\ngh repo # list | create | clone | view\ngh issue # list | create | comment | close | delete | view\ngh auth # login | status | token | refresh\ngh codespace # list | create | code | stop\n```\n\n## Installation\n\n```sh\n# note: Actions use dash, a light, POSIX compliant bourne shell alternative.\n# note: Use for portability: #!/usr/bin/env sh\n\n# install gh command\n./install.sh\n\n# shfmt \u0026 shellcheck: `make list`, `make lint`, `make fmt`, `make fmt_preview`\ncat Makefile\n```\n\n## Overview\n\n```sh\n# CORE\ngh --help\n# auth | browse | codespace | gist | issue | org | pr | co | project | release | repo\n\n# ACTIONS COMMANDS\n# cache | run | workflow\n\n# ADDITIONAL COMMANDS\n# alias | api | attestation | completion | config | extension | gpg-key | label\n# ruleset | search | secret | ssh-key | status | variable\n\n# HELP TOPICS\n# accessibility | actions | environment | exit-codes | formatting | mintty | reference\n```\n\n## Authentication\n\nhttps://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps\nhttps://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits\n\n```sh\n# get detailed info about auth state: accounts, protocol, token scopes\ngh auth status\ngh auth login\ngh auth refresh --scopes write:org,read:public_key # add\ngh auth refresh --scopes 'codespace'\ngh auth refresh --remove-scopes delete_repo # remove\n\n# for debug, but don't\ngh auth login --scopes admin:gpg_key,admin:org,admin:org_hook,admin:public_key,admin:repo_hook,codespace,delete_repo,delete:packages,gist,notifications,project,public_repo,read:audit_log,read:gpg_key,read:org,read:packages,read:project,read:public_key,read:repo_hook,read:user,repo_deployment,repo:invite,repo:status,security_events,user,user:email,user:follow,workflow,write:gpg_key,write:org,write:packages,write:public_key,write:repo_hook\ngh auth refresh --reset-scopes # minimum\n\n# checking commit verification\n# TL;DR - use codespace associated with the repo you're committing to. Locally, use a GPG key. Use the updated bootstrap.sh in dotfiles to set up GPG.\n\n# docs: setup gpg signing for git commits and tags\n# https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification\n# https://docs.github.com/en/authentication/managing-commit-signature-verification/displaying-verification-statuses-for-all-of-your-commits\n# https://docs.github.com/en/authentication/managing-commit-signature-verification/checking-for-existing-gpg-keys\n# https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key\n# https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account\n# https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key\n# https://docs.github.com/en/authentication/managing-commit-signature-verification/associating-an-email-with-your-gpg-key\n# https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits\n\n# docs: troubleshooting\n# https://docs.github.com/en/authentication/troubleshooting-commit-signature-verification/checking-your-commit-and-tag-signature-verification-status\n\n```\n\n## API\n\nAPI exists and is accessible through the CLI with `gh api`.\n\n- http://cli.github.com/manual/gh_api\n- https://docs.github.com/en/rest\n- https://docs.github.com/en/rest/quickstart\n\n```sh\n# Endpoints: Actions | Activity | Apps | Billing | Branches |\n# Security campaigns | Checks | Classroom | Code Scanning |\n# Security Settings | Codes of conduct | Codespaces | Collaborators |\n# Commits | Copilot | Credentials | Dependabot | Dependency graaph |\n# Deploy keys | Deployments | Emojis | Gists | Git dataset | Gitignore |\n# Interactions | Issues | Licenses | Markdown | Meta | Metrics | Migrations |\n# Models | Organizations | Packages | Pages | Private registries |\n# Projects (classic) | Pull requests | Rate Limit | Reactions | Releases |\n# Search | Secret scanning | Security advisories | Teams | Users\n\ngh api repos/jordanblakey/gh-scripting\ngh api repos/jordanblakey/gh-scripting | jq .security_and_analysis.secret_scanning.status\ngh api /octocat --method GET\ngh api /octocat -X GET\n\n# no CLI needed... except to get a bearer token\ncurl -X GET https://api.github.com/repos/octocat/Spoon-Knife/issues \\\n-H \"Accept: application/vnd.github+json\" \\\n-H \"Authorization: Bearer $(gh auth token)\"\n\ncurl -X POST $URL -H \"Accept: application/vnd.github/json\" \\\n-H \"X-GitHub-Api-Version: 2022-11-28\" \\\n-H \"Authorization: Bearer $(gh auth token)\" \\\n--data '{\"title\":\"hello from REST\",\"body\":\"echo echo echo\"}'\n```\n\n## Codespaces\n\n```sh\n# list available codespace sizes (from existing codespace)\ngh api /user/codespaces/CODESPACE-NAME/machines\n\n# create a new codespace\n gh codespace create --display-name virtually-magic-box \\\n --repo jordanblakey/gh-scripting \\\n --location EastUs \\\n --machine standardLinux32gb \\\n --status\n\ngh codespace view --codespace $CODESPACE_NAME # note that name is not display name\n\n# different ways of listing and filtering codespace names with jq\ngh codespace list --json name --jq .[].name # get names of all codespaces\ngh cs list --json name,repository --jq \"first(.[] | select(.repository | contains(\\\"part-of-repo-name\\\")) | .name)\" \u003e /tmp/buffer # get name of a codespace by\nset CODESPACE_NAME $(cat /tmp/buffer)\nset CODESPACE_NAME $(gh cs list --json 'name' --jq '.[] | select(.name | contains(\"space-memory\")) | .name')\ngh cs list --json name,repository --jq \"first(.[] | select(.repository | contains(\\\"part-of-repo-name\\\")) | .name)\"\n\n# or make a comma sep name,repo list that is greppable,cuttable. this may be the most practical and portable\nalias cslist \"gh cs list --json name,repository --jq '.[] | join(\\\",\\\")'\"\n# note: within codespace, permissions appear to be limited to the current repository, so list yields only the current codespace\ncslist | grep part-of-name-or-repo\n\n# note: you can connect to multiple codespaces simultaneously\ngh codespace code --codespace virtually-magic-box # open codespace in vscode ssh\n# shorthand to open codespace\ngh cs code -c $CODESPACE_NAME\n\n# cleanup\n# note: you can only have 2 codespaces running at a time\n# note: codespaces seem to be permanently tied to a single repository\ngh cs stop -c $CODESPACE_NAME\ngh cs view -c $CODESPACE_NAME # confirm stopping\ngh cs delete -c $CODESPACE_NAME\n\n# see also\ngh cs logs # doesn't seem to work\ngh cs ssh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjordanblakey%2Fgh-scripting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjordanblakey%2Fgh-scripting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjordanblakey%2Fgh-scripting/lists"}