Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created April 9, 2023 19:13
Show Gist options
  • Select an option

  • Save KyMidd/b5b8f9e4f62ac6f2cebf5d51307a5d84 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/b5b8f9e4f62ac6f2cebf5d51307a5d84 to your computer and use it in GitHub Desktop.
# Find archived repos
ARCHIVED_REPOS=$(gh repo list $GH_ORG -L 1000 --archived | cut -d "/" -f 2 | cut -f 1)
ARCHIVED_REPOS_COUNT=$(echo "$ARCHIVED_REPOS" | wc -l | xargs)
# Remove archived repos from ALL_REPOS
echo "Skipping $ARCHIVED_REPOS_COUNT archived repos, they are read only"
for repo in $ARCHIVED_REPOS; do
ALL_REPOS=$(echo "$ALL_REPOS" | grep -Ev "^$repo$")
done
# Remove any empty lines
ALL_REPOS=$(echo "$ALL_REPOS" | awk 'NF')
# Get repo count
ALL_REPOS_COUNT=$(echo "$ALL_REPOS" | wc -l | xargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment