hub-mirror

🎞 使用 github action - hub-mirror-action 的模板仓库,可以管理当前 GitHub 与其他的 hub 的存储库(当前仅包含 Gitee)的镜像同步。

MIT License

Stars
24

Sync GitHub to other hub

| 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

  1. Git GitBash
  2. SSH
ssh-keygen -t rsa
  1. GitHub Gitee

  2. id_rsa GitHub GitHub **** Secrets GITEE_PRIVATE_KEY

  ![](./static/add_secret_key.png)
  1. 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

  1. Gitee **** `` GITEE_TOKEN

PS

  1. GitHub GitHub **** Secrets GITEE_TOKEN

static_list()

static_list : 'repo1,repo2,repo3'

Template :

  1. sync2gitee.yml sync2gitee.cached.yml static_list actions/github-script : '${{ steps.info.outputs.result }},MY_REPO'
  2. 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

FAQ

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 **

** hub-mirror-action **

Gitee XXX

Gitee ( _ )( - )( . )**** 2~191

  1. ~~ Gitee GitHub Gitee ( _ )( - )( . )****~~
  2. 1 2020-10-14
  3. ****

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

MIT

Badges
Extracted from project README
sync2gitee sync2gitee(cached) sync2gitee(list) GitHub last commit LICENSE
Related Projects