Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add GITEA_USER #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion github2gitea-mirror
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -114,7 +115,11 @@ set_uid() {

# Sets the uid to the specified Gitea user
set_uid_user() {
uid=$($CURL "${header_options[@]}" $GITEA_URL/api/v1/users/${github_user} | jq .id)
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
Expand Down