diff --git a/README.md b/README.md index 927f03c..e91f2a6 100644 --- a/README.md +++ b/README.md @@ -61,14 +61,15 @@ jobs: GITEA_HOST: ${{ secrets.GITEA_HOST }} GITEA_USERNAME: ${{ secrets.GITEA_USERNAME }} GITEA_PAT: ${{ secrets.GITEA_PAT }} - CONFIG_CREATE_ORG: true - CONFIG_REMOVE_INEXIST_REPO: false - CONFIG_REMOVE_EXISTING_REPO: false - CONFIG_MIRROR_OWNED: true - CONFIG_MIRROR_FORKED: true - CONFIG_MIRROR_STARRED: false - CONFIG_MIRROR_COLLABORATOR: false - CONFIG_MIRROR_ORGANIZATION: false + CREATE_ORG: true + REMOVE_INEXIST_REPO: false + REMOVE_EXISTING_REPO: false + MIRROR_OWNED: true + MIRROR_PRIVATE: true + MIRROR_FORKED: true + MIRROR_STARRED: false + MIRROR_COLLABORATOR: false + MIRROR_ORGANIZATION: false RULE_MODE: 'blacklist' RULE_REGEX: 'EpicGames/.*,NVIDIAGameWorks/.*' ``` @@ -96,6 +97,7 @@ You can customize these options for mirroring: | REMOVE_INEXIST_REPO | Remove all repositories in Gitea owned by the user (including those in organizations) that do not exist in GitHub. | | REMOVE_EXISTING_REPO | Remove existing repositories in Gitea. This will only remove the repositories that have the same name as the repositories in GitHub. You may not want to enable this option, since Gitea will automatically fetch the mirror repositories every 8 hours. | | MIRROR_OWNED | Mirror the repositories you own. | +| MIRROR_PRIVATE | Mirror private repositories you own. | | MIRROR_FORKED | Mirror the repositories you forked. | | MIRROR_STARRED | Mirror the repositories you starred. | | MIRROR_COLLABORATOR | Mirror the repositories that you have collaborator access. See: https://docs.github.com/zh/rest/repos/repos#list-repositories-for-the-authenticated-user | diff --git a/action.yml b/action.yml index 0421a4a..f0e2a42 100644 --- a/action.yml +++ b/action.yml @@ -36,6 +36,10 @@ inputs: description: 'Mirror the repositories you own' required: false default: true + MIRROR_PRIVATE: + description: 'Mirror private repositories you own' + required: false + default: true MIRROR_FORKED: description: 'Mirror the repositories you forked' required: false diff --git a/entrypoint.sh b/entrypoint.sh index 15794ef..f734d3a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,17 +8,48 @@ git clone https://github.com/katorlys/github-mirror-gitea.git cd github-mirror-gitea -export GITHUB_PAT=${GITHUB_PAT} -export GITEA_PAT=${GITEA_PAT} -export GITEA_HOST=${GITEA_HOST} -export GITEA_USERNAME=${GITEA_USERNAME} -export GITHUB_USERNAME=${GITHUB_USERNAME} +if [ -n "${GITHUB_USERNAME}" ]; then + export GITHUB_USERNAME=${GITHUB_USERNAME} +else + echo ">> Error: You have to set your GitHub username <<" + exit 1 +fi + +if [ -n "${GITHUB_PAT}" ]; then + export GITHUB_PAT=${GITHUB_PAT} +else + echo ">> Error: You have to set your GitHub personal access token <<" + exit 1 +fi + +if [ -n "${GITEA_USERNAME}" ]; then + export GITEA_USERNAME=${GITEA_USERNAME} +else + echo ">> Error: You have to set your Gitea username <<" + exit 1 +fi + +if [ -n "${GITEA_HOST}" ]; then + export GITEA_HOST=${GITEA_HOST} +else + echo ">> Error: You have to set your Gitea hostname <<" + exit 1 +fi + +if [ -n "${GITEA_PAT}" ]; then + export GITEA_PAT=${GITEA_PAT} +else + echo ">> Error: You have to set your Gitea personal access token <<" + exit 1 +fi + export CREATE_ORG=${CREATE_ORG} export REMOVE_INEXIST_REPO=${REMOVE_INEXIST_REPO} export REMOVE_EXISTING_REPO=${REMOVE_EXISTING_REPO} export MIRROR_OWNED=${MIRROR_OWNED} +export MIRROR_PRIVATE=${MIRROR_PRIVATE} export MIRROR_FORKED=${MIRROR_FORKED} -export MIRROR_STARED=${MIRROR_STARED} +export MIRROR_STARRED=${MIRROR_STARRED} export MIRROR_COLLABORATOR=${MIRROR_COLLABORATOR} export MIRROR_ORGANIZATION=${MIRROR_ORGANIZATION} export REPO_RULE=${MODE}