add GITEA_USER

This commit is contained in:
MuratovAS 2024-01-12 02:39:19 +05:00
parent 6428a6847c
commit 764feb314f
No known key found for this signature in database
GPG key ID: CE09BE03367711AD
2 changed files with 7 additions and 1 deletions

View file

@ -23,6 +23,7 @@ First, setup your environment variables like this:
export ACCESS_TOKEN=123
export GITEA_URL=https://gitea.example.com
export GITHUB_TOKEN=456
export GITEA_USER=789
```
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
# GITERA_URL = Gitea URL
# GITHUB_TOKEN = GitHub personal access token
# GITEA_USER = Which user creates the repository
# Displays the given input including "=> " on the console.
log () {
@ -114,7 +115,11 @@ set_uid() {
# Sets the uid to the specified Gitea user
set_uid_user() {
if [[ -z "${GITEA_USER}" ]]; then
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