Created
July 8, 2016 18:08
-
-
Save whyvez/6e090e3db9e4fca4e3ff84eeed9c2897 to your computer and use it in GitHub Desktop.
Shell script that prints out repos in a CSV format as a task list for repo cleanup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# prints a list of github org repos as csv with additional fields to track cleanup tasks. | |
# usage: bash ./repo-cleanup.sh <org> <your-gh-pat> | |
# gh api docs: | |
# auth: https://developer.github.com/v3/#authentication | |
# repos: https://developer.github.com/v3/repos/ | |
# pagination: https://developer.github.com/v3/#pagination | |
org=$1 | |
access_token=$2 | |
curl "https://api.github.com/orgs/$org/repos?access_token=$access_token&page=1&per_page=100" \ | |
| jq '.[].name' \ | |
| LC_COLLATE=C sort --ignore-case \ | |
| awk -F, -v org=$org ' | |
BEGIN { | |
print "repo" FS "owner" FS "readme" FS "license" FS "tests" FS "ci" FS "publish" FS "reviewed_by" | |
} | |
{ | |
gsub("\"", ""); | |
print $1 FS org FS "no" FS "no" FS "no" FS "no" FS "no" FS "na" | |
} ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment