-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
35 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
- name: Login Source GitHub | ||
run: | | ||
gh --version | ||
echo "${{ secrets.SOURCE_TOKEN }}" | gh auth login --with-token | ||
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
gh auth status | ||
- name: List repos | ||
|
@@ -24,12 +24,12 @@ jobs: | |
echo "::set-output name=repo_list::${repo_list}" | ||
- name: GitHub Org to Gitee Org | ||
uses: k8scat/[email protected].2 | ||
uses: k8scat/[email protected].3 | ||
with: | ||
source_protocol: https | ||
source_host: github.com | ||
source_username: huayin-opensource | ||
source_token: ${{ secrets.SOURCE_TOKEN }} | ||
source_token: ${{ secrets.GITHUB_TOKEN }} | ||
dest_protocol: https | ||
dest_host: gitee.com | ||
dest_username: huayin-opensource | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
- name: Login Source GitHub | ||
run: | | ||
gh --version | ||
echo "${{ secrets.SOURCE_TOKEN }}" | gh auth login --with-token | ||
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
gh auth status | ||
- name: List repos | ||
|
@@ -24,12 +24,12 @@ jobs: | |
echo "::set-output name=repo_list::${repo_list}" | ||
- name: GitHub to BitBucket | ||
uses: k8scat/[email protected].2 | ||
uses: k8scat/[email protected].3 | ||
with: | ||
source_protocol: https | ||
source_host: github.com | ||
source_username: k8scat | ||
source_token: ${{ secrets.SOURCE_TOKEN }} | ||
source_token: ${{ secrets.GITHUB_TOKEN }} | ||
dest_protocol: https | ||
dest_host: bitbucket.org | ||
dest_username: k8scat | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ jobs: | |
- name: Login Source GitHub | ||
run: | | ||
gh --version | ||
echo "${{ secrets.SOURCE_TOKEN }}" | gh auth login --with-token | ||
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
gh auth status | ||
- name: List repos | ||
|
@@ -26,12 +26,12 @@ jobs: | |
echo "::set-output name=repo_list::${repo_list}" | ||
- name: GitHub to Coding | ||
uses: k8scat/[email protected].2 | ||
uses: k8scat/[email protected].3 | ||
with: | ||
source_protocol: https | ||
source_host: github.com | ||
source_username: k8scat | ||
source_token: ${{ secrets.SOURCE_TOKEN }} | ||
source_token: ${{ secrets.GITHUB_TOKEN }} | ||
dest_protocol: https | ||
dest_host: e.coding.com/k8scat | ||
dest_username: ${{ secrets.CODING_PROJECT_NAME }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
- name: Login Source GitHub | ||
run: | | ||
gh --version | ||
echo "${{ secrets.SOURCE_TOKEN }}" | gh auth login --with-token | ||
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
gh auth status | ||
- name: List repos | ||
|
@@ -24,12 +24,12 @@ jobs: | |
echo "::set-output name=repo_list::${repo_list}" | ||
- name: GitHub to Gitea | ||
uses: k8scat/[email protected].2 | ||
uses: k8scat/[email protected].3 | ||
with: | ||
source_protocol: https | ||
source_host: github.com | ||
source_username: k8scat | ||
source_token: ${{ secrets.SOURCE_TOKEN }} | ||
source_token: ${{ secrets.GITHUB_TOKEN }} | ||
dest_protocol: https | ||
dest_host: gitea.com | ||
dest_username: k8scat | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
- name: Login Source GitHub | ||
run: | | ||
gh --version | ||
echo "${{ secrets.SOURCE_TOKEN }}" | gh auth login --with-token | ||
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
gh auth status | ||
- name: List repos | ||
|
@@ -24,12 +24,12 @@ jobs: | |
echo "::set-output name=repo_list::${repo_list}" | ||
- name: GitHub to Gitee | ||
uses: k8scat/[email protected].2 | ||
uses: k8scat/[email protected].3 | ||
with: | ||
source_protocol: https | ||
source_host: github.com | ||
source_username: k8scat | ||
source_token: ${{ secrets.SOURCE_TOKEN }} | ||
source_token: ${{ secrets.GITHUB_TOKEN }} | ||
dest_protocol: https | ||
dest_host: gitee.com | ||
dest_username: k8scat | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
- name: Login Source GitHub | ||
run: | | ||
gh --version | ||
echo "${{ secrets.SOURCE_TOKEN }}" | gh auth login --with-token | ||
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
gh auth status | ||
- name: List repos | ||
|
@@ -24,12 +24,12 @@ jobs: | |
echo "::set-output name=repo_list::${repo_list}" | ||
- name: GitHub to GitHub | ||
uses: k8scat/[email protected].2 | ||
uses: k8scat/[email protected].3 | ||
with: | ||
source_protocol: https | ||
source_host: github.com | ||
source_username: k8scat | ||
source_token: ${{ secrets.SOURCE_TOKEN }} | ||
source_token: ${{ secrets.GITHUB_TOKEN }} | ||
dest_protocol: https | ||
dest_host: github.com | ||
dest_username: k8scat-archived | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ jobs: | |
- name: Login Source GitHub | ||
run: | | ||
gh --version | ||
echo "${{ secrets.SOURCE_TOKEN }}" | gh auth login --with-token | ||
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
gh auth status | ||
- name: List repos | ||
|
@@ -35,12 +35,12 @@ jobs: | |
echo "::set-output name=repo_list::${repo_list}" | ||
- name: GitHub to GitLab | ||
uses: k8scat/[email protected].2 | ||
uses: k8scat/[email protected].3 | ||
with: | ||
source_protocol: https | ||
source_host: github.com | ||
source_username: k8scat | ||
source_token: ${{ secrets.SOURCE_TOKEN }} | ||
source_token: ${{ secrets.GITHUB_TOKEN }} | ||
dest_protocol: https | ||
dest_host: gitlab.com | ||
dest_username: k8scat | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
os = $(shell uname -s) | ||
|
||
version = 0.1.2 | ||
version = 0.1.3 | ||
image = mirror-git:$(version) | ||
|
||
cr_user = gigrator | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
# Created by K8sCat <[email protected]> | ||
set +e | ||
|
||
PROTOCOL_SSH="ssh" | ||
PROTOCOL_HTTPS="https" | ||
|
||
function init_workdir() { | ||
WORKDIR="/data/repos" | ||
mkdir -p ${WORKDIR} | ||
|
@@ -125,23 +128,23 @@ function init_ssh() { | |
mkdir -p "${SSH_DIR}" | ||
chmod 0700 "${SSH_DIR}" | ||
|
||
if [[ "${INPUT_SOURCE_PROTOCOL}" = "ssh" ]]; then | ||
if [[ "${INPUT_SOURCE_PROTOCOL}" = "${PROTOCOL_SSH}" ]]; then | ||
INPUT_SOURCE_HOST=$(write_ssh_config "source" "${INPUT_SOURCE_HOST}" "${INPUT_SOURCE_PORT}" "${INPUT_SOURCE_USERNAME}" "${INPUT_SOURCE_PRIVATE_KEY}") | ||
export INPUT_SOURCE_HOST | ||
fi | ||
if [[ "${INPUT_DEST_PROTOCOL}" = "ssh" ]]; then | ||
if [[ "${INPUT_DEST_PROTOCOL}" = "${PROTOCOL_SSH}" ]]; then | ||
INPUT_DEST_HOST=$(write_ssh_config "dest" "${INPUT_DEST_HOST}" "${INPUT_DEST_PORT}" "${INPUT_DEST_USERNAME}" "${INPUT_DEST_PRIVATE_KEY}") | ||
export INPUT_DEST_HOST | ||
fi | ||
} | ||
|
||
function gen_source_addr() { | ||
if [[ "${INPUT_SOURCE_PROTOCOL}" = "ssh" ]]; then | ||
if [[ "${INPUT_SOURCE_PROTOCOL}" = "${PROTOCOL_SSH}" ]]; then | ||
source_addr="git@${INPUT_SOURCE_HOST}:${INPUT_SOURCE_USERNAME}/${REPO_NAME}.git" | ||
echo "${source_addr}" | ||
return | ||
fi | ||
if [[ "${INPUT_SOURCE_PROTOCOL}" = "https" ]]; then | ||
if [[ "${INPUT_SOURCE_PROTOCOL}" = "${PROTOCOL_HTTPS}" ]]; then | ||
source_addr="https://${INPUT_SOURCE_TOKEN_USERNAME}:${INPUT_SOURCE_TOKEN}@${INPUT_SOURCE_HOST}" | ||
if [[ -n "${INPUT_SOURCE_PORT}" ]]; then | ||
source_addr="${source_addr}:${INPUT_SOURCE_PORT}" | ||
|
@@ -155,12 +158,12 @@ function gen_source_addr() { | |
} | ||
|
||
function gen_dest_addr() { | ||
if [[ "${INPUT_DEST_PROTOCOL}" = "ssh" ]]; then | ||
if [[ "${INPUT_DEST_PROTOCOL}" = "${PROTOCOL_SSH}" ]]; then | ||
dest_addr="git@${INPUT_DEST_HOST}:${INPUT_DEST_USERNAME}/${REPO_NAME}.git" | ||
echo "${dest_addr}" | ||
return | ||
fi | ||
if [[ "${INPUT_DEST_PROTOCOL}" = "https" ]]; then | ||
if [[ "${INPUT_DEST_PROTOCOL}" = "${PROTOCOL_HTTPS}" ]]; then | ||
dest_addr="https://${INPUT_DEST_TOKEN_USERNAME}:${INPUT_DEST_TOKEN}@${INPUT_DEST_HOST}" | ||
if [[ -n "${INPUT_DEST_PORT}" ]]; then | ||
dest_addr="${dest_addr}:${INPUT_DEST_PORT}" | ||
|
@@ -246,7 +249,7 @@ function main() { | |
init_message | ||
init_ssh | ||
|
||
notify "Mirror Git starting" | ||
notify "Mirror Git started" | ||
if mirror; then | ||
notify "Mirror Git finished" | ||
else | ||
|