Initial commit :3

This commit is contained in:
CherryKitten 2024-03-09 11:55:43 +01:00
commit b05c8b727f
Signed by: sammy
GPG key ID: 98D8F75FB0658276
2 changed files with 23 additions and 0 deletions

3
README.md Normal file
View 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
View 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