Initial commit :3
This commit is contained in:
commit
b05c8b727f
2 changed files with 23 additions and 0 deletions
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Scripts
|
||||
|
||||
collection of simple small scripts that don't really need their own repo
|
20
github_star_mirror.sh
Executable file
20
github_star_mirror.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#/!/bin/bash
|
||||
|
||||
# Gets the 100 most recently starred repositories of $GITHUB_USER, and creates Mirrors on $FORGEJO_URL
|
||||
# Dependencies: jq & curl
|
||||
# env vars:
|
||||
# GITHUB_USER
|
||||
# FORGEJO_USER
|
||||
# FORGEJO_TOKEN (password or api token)
|
||||
# FORGEJO_URL
|
||||
|
||||
curl https://api.github.com/users/$GITHUB_USER/starred\?per_page\=100\&page\=1 |
|
||||
jq -r '.[] | [.name, .html_url] | @tsv' |
|
||||
while i=$'\t' read -r name url; do
|
||||
curl \
|
||||
-u $FORGEJO_USER:$FORGEJO_TOKEN \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "{\"clone_addr\": \"$url\", \"repo_name\": \"$name\", \"mirror\": true, \"repo_owner\": \"Mirrors\"}" \
|
||||
$FORGEJO_URL/api/v1/repos/migrate
|
||||
done
|
Loading…
Reference in a new issue