-
-
Save L04DB4L4NC3R/3e366e1ac93c3d3036d107c2386b1e46 to your computer and use it in GitHub Desktop.
GitHub repo creation script (from template)
This file contains 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
GITHUB_PERSONAL_ACCESS_TOKEN= | |
GITHUB_TEMPLATE_NAME= | |
GITHUB_TEMPLATE_OWNER= | |
GITHUB_ORGANIZATION_OWNER= |
This file contains 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
#!/bin/bash | |
source ./.env | |
template_name=$GITHUB_TEMPLATE_NAME | |
template_owner=$GITHUB_TEMPLATE_OWNER | |
owner_name=$GITHUB_ORGANIZATION_OWNER | |
token=$GITHUB_PERSONAL_ACCESS_TOKEN | |
echo "Running..." | |
while p= read -r line; do | |
echo "Creating $line" | |
curl -XPOST -d "{\"owner\": \"$owner_name\", \"name\": \"$line\"}" https://api.github.com/repos/$template_owner/$template_name/generate -H "Accept: application/vnd.github.baptiste-preview+json" -H "Authorization: token $token" &>/dev/null | |
echo "Sleeping for 1.5s" | |
sleep 1.5 # For avoiding rate limit of 10 req per min | |
done < ./repos.txt |
This file contains 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
test1 | |
test2 | |
test3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment