Skip to content
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

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MuratovAS and thank you for your contribution!

I have one question/remark to your PR:
Why did you choose to specify the Gitea (target) user as an environment variable? All other parameters (besides the GITEA_URL which also should be fixed) get passed as command line arguments (e.g., --user for the GitHub user name).

Hence, I propose that you change/extend your PR to introduce a new command line argument --gitea-user/-g or --target-user/-t to pass this information to the script instead of the ENV.


# 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