This commit is contained in:
Aleksej Muratov 2024-11-29 01:29:19 +00:00 committed by GitHub
commit 3926efd86a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -30,6 +30,7 @@ First, setup your environment variables like this:
export ACCESS_TOKEN=123 export ACCESS_TOKEN=123
export GITEA_URL=https://gitea.example.com export GITEA_URL=https://gitea.example.com
export GITHUB_TOKEN=456 export GITHUB_TOKEN=456
export GITEA_USER=789
``` ```
There are four modes of operation, which the script can print out to the console: There are four modes of operation, which the script can print out to the console:

View file

@ -17,6 +17,7 @@
# ACCESS_TOKEN = Gitea token # ACCESS_TOKEN = Gitea token
# GITERA_URL = Gitea URL # GITERA_URL = Gitea URL
# GITHUB_TOKEN = GitHub personal access token # GITHUB_TOKEN = GitHub personal access token
# GITEA_USER = Which user creates the repository
# Displays the given input including "=> " on the console. # Displays the given input including "=> " on the console.
log () { log () {
@ -114,7 +115,11 @@ set_uid() {
# Sets the uid to the specified Gitea user # Sets the uid to the specified Gitea user
set_uid_user() { set_uid_user() {
if [[ -z "${GITEA_USER}" ]]; then
uid=$($CURL "${header_options[@]}" $GITEA_URL/api/v1/users/${github_user} | jq .id) uid=$($CURL "${header_options[@]}" $GITEA_URL/api/v1/users/${github_user} | jq .id)
else
uid=$($CURL "${header_options[@]}" $GITEA_URL/api/v1/users/${GITEA_USER} | jq .id)
fi
} }
# Fetches all starred repos of the given user to JSON files # Fetches all starred repos of the given user to JSON files