Giter Site home page Giter Site logo

ivanzhongyq / hub-mirror-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phpdragon/hub-mirror-action

0.0 1.0 0.0 39 KB

一个提供代码仓库之间同步用的Github Action ,比如(Github同步至Gitee)

Home Page: https://www.cnblogs.com/phpdragon/p/12787248.html

License: MIT License

Dockerfile 3.72% Shell 96.28%

hub-mirror-action's Introduction

Hub Mirror Action

English | 简体中文

Action for mirroring repos between Hubs (like Github and Gitee)

Tutorial

steps:
- name: Mirror the Github organization repos to Gitee.
  uses: Yikun/hub-mirror-action@master
  with:
    src: github/kunpengcompute
    dst: gitee/kunpengcompute
    dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
    dst_token: ${{ secrets.GITEE_TOKEN }}
    account_type: org

Here is a workflow to mirror all repos from Github/kunpengcompute organization to Gitee/kunpengcompute organization.

You can see more real workflows in here.

Usage

  • src source account, such as github/kunpengcompute, is the Github kunpengcompute account.
  • dst Destination account, such as /kunpengcompute, is the Gitee kunpengcompute account.
  • dst_key the ssh key to push code in destination account,You can get the Github sshkeys in here,the Gitee ssh key in here.
  • dst_token the API token to create non-existent repo, You can get Github token in here, and the Gitee in here.
  • account_type (optional) default is user, the account type of src and dst account, can be set to org or user,only support mirror between same account type (that is "org to org" or "user to user").
  • clone_style (optional) default is https, can be set to ssh or https.
  • cache_path (optional) let code clone in specific path, can be used with actions/cache to speed up mirror.
  • black_list (optional) the black list, such as “repo1,repo2,repo3”.
  • white_list (optional) the white list, such as “repo1,repo2,repo3”.
  • static_list (optional) Only mirror repos in the static list, but don't get list from repo api dynamically (the white/black list is still available). like 'repo1,repo2,repo3'
  • force_update (optional) Force to update the destination repo, use '-f' flag do 'git push'

Scenarios

Organization mirror, mirror the Github/kunpengcompute to Gitee/kunpengcompute

- name: Organization mirror
  uses: Yikun/hub-mirror-action@master
  with:
    src: github/kunpengcompute
    dst: gitee/kunpengcompute
    dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
    dst_token: ${{ secrets.GITEE_TOKEN }}
    account_type: org

White list, only mirror the Yikun/hub-mirror-action

- name: Single repo mirror
  uses: Yikun/hub-mirror-action@master
  with:
    src: github/Yikun
    dst: gitee/yikunkero
    dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
    dst_token: ${{ secrets.GITEE_TOKEN }}
    white_list: "hub-mirror-action"

Black list, only mirror the repos excepts hub-mirror-action and hashes

- name: Black list
  uses: Yikun/hub-mirror-action@master
  with:
    src: github/Yikun
    dst: gitee/yikunkero
    dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
    dst_token: ${{ secrets.GITEE_TOKEN }}
    white_list: "hub-mirror-action,hashes"

clone style, use ssh clone style

- name: ssh clone style
  uses: Yikun/hub-mirror-action@master
  with:
    src: github/Yikun
    dst: gitee/yikunkero
    dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
    dst_token: ${{ secrets.GITEE_TOKEN }}
    clone_style: "ssh"

set sepecific cache

- name: Mirror with specific cache
  uses: Yikun/hub-mirror-action@master
  with:
    src: github/Yikun
    dst: gitee/yikunkero
    dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
    dst_token: ${{ secrets.GITEE_TOKEN }}
    cache_path: /github/workspace/hub-mirror-cache

Force udpate

- name: Mirror with force push (git push -f)
  uses: Yikun/hub-mirror-action@master
  with:
    src: github/Yikun
    dst: gitee/yikunkero
    dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
    dst_token: ${{ secrets.GITEE_TOKEN }}
    force_update: true

FAQ

  • How to use secrets to add token and key?

    You can use below steps to add secrets, you can also see more in Secrets.

    1. Get Token and Key,you can get them in ssh key and token.
    2. Add Secrets,add settings-secrets in repo,like GITEE_PRIVATE_KEYGITEE_TOKEN
    3. Add workflow,add the workflow file into .github/workflows.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.