Shell scripting and gh
FTW:
#!/bin/bash
org_name="MYORGNAME"
repo_list=`gh repo list $org_name --limit 1000 | awk '{print $1}'`
template_repo=$1
if [ -z "$template_repo" ]
then
echo "Usage: $0 <template_repo>"
echo " List repositories generated from a given template repository"
echo "ABORTING!"
exit 1
fi
echo "Searching for repositories generated from template: $template_repo"
for repo in $repo_list
do
repo_info=`gh api repos/$repo`
echo "$repo_info" | jq -r ".template_repository.full_name" | grep "$template_repo" 2>&1 > /dev/null
if [ "$?" -eq "0" ]
then
echo "repo_using_template: $repo"
fi
done
Then, run ./find_repo_by_template.sh <template_repo>
to get a listing of repositories that use that template, AFTER setting the org_name
variable. My use case required searching within an organization. If you have a different use case, you should be able to easily tweak my script to get the desired results.