Skip to content

Instantly share code, notes, and snippets.

@gabesullice
Last active August 20, 2024 12:57
Show Gist options
  • Save gabesullice/71302298db7d3fb4737efc2b326bbd3b to your computer and use it in GitHub Desktop.
Save gabesullice/71302298db7d3fb4737efc2b326bbd3b to your computer and use it in GitHub Desktop.
Render all of a GitHub user's public repositories as a Markdown list
#!/bin/bash
USER="$1"
gh api "/users/${USER}/repos?type=owner" \
| jq -r '.[] | select(.private == false) | " - \(.name) (hosted at \(.html_url))"'
@gabesullice
Copy link
Author

gabesullice commented Aug 20, 2024

Usage

First, install the GitHub CLI and the jq JSON processor.

Then execute:

gh auth login

Once authenticated, run the script by passing a GitHub username as a command-line argument. For example:

./list-public-user-repos.sh gabesullice

The output should resemble:

  - accountman-misc (hosted at https://github.com/gabesullice/accountman-misc)
  - acidity (hosted at https://github.com/gabesullice/acidity)
… snip …
  - debian-docker-host (hosted at https://github.com/gabesullice/debian-docker-host)
  - decoupled-navigation-demo-app (hosted at https://github.com/gabesullice/decoupled-navigation-demo-app)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment