repos-mirror-action github action实现不同仓库代码同步
        【摘要】 一个用于在hub间(例如Github,Gitee)代码仓库同步的action 背景在开源贡献的代码托管的过程中,我们有时候有需要将Github的代码同步到其他远端仓库的需求。具体的,对于我们目前参与的项目来说核心诉求是:以Github社区作为主仓,并且定期自动同步到Gitee作为镜像仓库。github action:https://github.com/marketplace/actions...
    
    
    
    一个用于在hub间(例如Github,Gitee)代码仓库同步的action
背景
在开源贡献的代码托管的过程中,我们有时候有需要将Github的代码同步到其他远端仓库的需求。具体的,对于我们目前参与的项目来说核心诉求是:以Github社区作为主仓,并且定期自动同步到Gitee作为镜像仓库。
github action:
 https://github.com/marketplace/actions/repo-mirror-sync
实现

- 将其他公共或私有存储库(例如模板存储库)与当前存储库同步
 - 支持不同的 git 提供商,如 GitLab、Gittea…作为源(使用 https)。
 - 源存储库和目标存储库不一定需要具有相同的基本历史记录。
 
因此,可以借助该操作合并两个不同的存储库。
用法
模板库
name: <action-name>
on: 
  - push
  - delete
jobs:
  sync:
    runs-on: ubuntu-latest
    name: Repo Mirror Sync
    steps:
    - uses: actions/checkout@v3
    - name: Repo Mirror Sync
      uses: kubeservice-stack/repos-mirror-action@<latest version>
      with:
        # Such as https://github.com/dongjiang1989/mirror-action.git
        target-url: <target-url>
        # Such as dongjiang1989
        target-username: <target-username>
        # You can store token in your project's 'Setting > Secrets' and reference the name here. Such as ${{ secrets.ACCESS_TOKEN }}
        target-token: <target-token>
 配置参数
| Variable | Description | Required | [Default] | 
   
|---|---|---|---|
| target-token | 回购协议的令牌。可以兑换使用${{ secrets.GITHUB_TOKEN } | 
    true | 
    |
| target-username | 存储库用户名 | true | 
    |
| target-url | https协议的目标 URL | 
    true | 
    
其他:代码工程
        【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
            cloudbbs@huaweicloud.com
        
        
        
        
        
        
        - 点赞
 - 收藏
 - 关注作者
 
            
           
评论(0)