🎞 使用 github action - hub-mirror-action 的模板仓库,可以管理当前 GitHub 与其他的 hub 的存储库(当前仅包含 Gitee)的镜像同步。
MIT License
| English
GitHub action - hub-mirror-action GitHub
hub
( Gitee
)
**PStemplate
**
src
()github/yi-Xu-0100
GitHub
yi-Xu-0100
dst
()gitee/yiXu0100
Gitee
yiXu0100
dst_key
()dst_key
SSH key
GitHub
SSH
Gitee
SSH
dst_key
Git
GitBash
SSH
ssh-keygen -t rsa
GitHub
Gitee
id_rsa
GitHub
GitHub
**** Secrets
GITEE_PRIVATE_KEY
![](./static/add_secret_key.png)
id_rsa.pub
Gitee
Gitee
**** SSH
hub-mirror
![](./static/add_pub_key.png)
dst_token
()dst_token
API tokens
GitHub
Gitee
dst_token
Gitee
GitHub
Gitee
**** `` GITEE_TOKEN
PS
GitHub
GitHub
**** Secrets
GITEE_TOKEN
static_list
()static_list
: 'repo1,repo2,repo3'
[email protected]
hub
GitHub
Gitee
[email protected]
**Template
:
sync2gitee.yml
sync2gitee.cached.yml
static_list
actions/github-script
: '${{ steps.info.outputs.result }},MY_REPO'
sync2gitee.list.yml
static_list
yi-Xu-0100/repo-list-generator
repoList
repoList
****
account_type
()account_type
user
org
force_update
()force_update
GitHub
Gitee
true
GitHub
Gitee
false
GitHub
Gitee
cache_path
()** cache
actions/cache
**
cache_path
actions/cache
sync2gitee.yml
cache_path
sync2gitee.cached.yml
sync2gitee.list.yml
cache_path
sync2gitee.yml
sync2gitee.cached.yml
static_list
template
.github/workflows
**
**sync2gitee.cached.yml
hub-mirror-action
**
hub-mirror-action
static_list
sync2gitee.list.yml
yi-Xu-0100/repo-list-generator
** repoList
**
Gitee
XXX
Gitee
( _
)( -
)( .
)**** 2~191
Gitee
GitHub
Gitee ( _
)( -
)( .
)****~~actions/cache
actions/cache
template/sync2gitee.cache.yaml
**** cache
key
**** cache
- name: Get repo and time
id: info
uses: actions/[email protected]
with:
result-encoding: string
script: |
core.setOutput('time', new Date(Date.now()).toISOString().replace(/[^0-9]/g, ""));
core.setOutput('key', `${context.repo.owner}-${context.repo.repo}`);
return context.repo.repo;
- name: Cache src repos
uses: actions/[email protected]
id: cache
with:
path: ${{ github.workspace }}/hub-mirror-cache
key: ${{ runner.os }}-${{ steps.info.outputs.key }}-cache-${{ steps.info.outputs.time }}
restore-keys: ${{ runner.os }}-${{ steps.info.outputs.key }}-cache-
- name: Mirror the GitHub repos to Gitee with cache
uses: Yikun/[email protected]
with:
src: github/yi-Xu-0100
dst: gitee/yiXu0100
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: '${{ steps.info.outputs.result }}'
cache_path: /github/workspace/hub-mirror-cache
account_type: user
force_update: true
id
info
actions/github-script
static_list
ISO
cache
{owner}-{repo}
path
hub-mirror-action
cache_path
/github/workspace/hub-mirror-cache
key
runner.os
steps.info.outputs.key
steps.info.outputs.time
restore-keys
key
7
5G
cache
cache
hub-mirror-action
actions/cache
template/sync2gitee.list.yaml
static_list
- name: Generate repo list
id: repo
uses: yi-Xu-0100/[email protected]
with:
user: yi-Xu-0100
my_token: ${{ secrets.REPO_TOKEN }}
- name: Mirror hub with cache and list
uses: Yikun/[email protected]
with:
src: github/yi-Xu-0100
dst: gitee/yiXu0100
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: '${{ steps.repo.outputs.repoList }}'
cache_path: /github/workspace/hub-mirror-cache
account_type: user
force_update: true
id
repo
yi-Xu-0100/repo-list-generator
${{ secrets.REPO_TOKEN }}
Generate my_token
static_list
${{ steps.repo.outputs.repoList }}
repoList
hub-mirror-action