Comments (17)
所以,结论应该是由于Gitee的限制,无法做到同步。另外,对于这种不同repo名字的同步,应该支持吗?如果想支持的话有什么优雅的办法吗?
我个人认为不应该支持,:),因为破坏了Hub同步的概念,不应该对某个库有特殊的处理。
但话说回来,这种由于各Hub见的能力不同,导致的差异,应该有些机制可以弥补,如果让我做的话,我可能会通过一个配置设置一些mapping规则:
steps:
- name: Mirror the Github organization repos to Gitee with mapping.
uses: Yikun/hub-mirror-action@master
with:
src: github/21ki
dst: gitee/Myki
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
mapping: "21ki.github.io=Myki"
这是一个比较理想的实现吗?
from hub-mirror-action.
Finally, 在这个PR #113 里,引入了mapping的支持。目前使用的语法是:
mappings: "a=>b, c=>d"
为什么是=>
?:先开始准备"="或者"==",但是因为感觉等号表达双向相等的语义比较强,所以使用了"=>"来做这个特性。你觉得合理吗?
为什么是mappings
?:其实严格来说应该是source repo mappings,但是想想,也不会有destination repo mappings的这种情况,所以直接叫mappings吧!
大家可以通过Yikun/hub-mirror-action@mappings
来试用了。完整的demo类似于:
- name: mirror with mappings
uses: Yikun/hub-mirror-action@mappings
with:
src: github/yikun
dst: gitee/yikunkero
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: "yikun.github.com"
mappings: "yikun.github.com=>blog"
他将会将github.com/yikun/yikun.github.com映射到gitee.com/yikunkero/blog
几个温馨的提示:
- 注意检查映射的仓库名是否已经存在,避免被错误覆盖。
- 映射不具备传递性,也就是说,如果你
a=>b, b=>c
,不会把a镜像到c的。
欢迎反馈建议!
cc 所有在这个issue里面点过赞,评论过的人:@youthlin @fakedon @21ki @yi-Xu-0100 @wukuai @dyxang @Dragon1573 ,你们的反馈非常重要,感谢!
from hub-mirror-action.
感谢大家的关注和反馈。代码已Merge到主干~
from hub-mirror-action.
有人试过了木有,我这边在CI试了下,没有什么问题。
mappings: 'hashes=>hashes_gitee'
:把https://gitee.com/yikun/hashes 同步到 https://gitee.com/yikunkero/hashes_gitee。
如果没更多反对,我将在1周或者2周后合入这个feature。
from hub-mirror-action.
@youthlin https://github.com/youthlin/t/blob/cd42a8fa88d826d5a3eb51fec7c535e82e8de4ff/.github/workflows/gitee.yaml
https://github.com/youthlin/t 同步到 https://gitee.com/youthlin/gottext 似乎也是OK的。
感谢试用。
from hub-mirror-action.
@21ki 目前能力是不支持从一个A名字的库,同步到B名字的库。
from hub-mirror-action.
@21ki 你可以先使用 gitee 同步仓库的方式,创建这个仓库,然后这个 action 的推送应该是没有问题的。
见 yi-Xu-0100/hub-mirror#gitee-无法创建-xxx-仓库如何解决
from hub-mirror-action.
你可以先使用 gitee 同步仓库的方式,创建这个仓库
@yi-Xu-0100 没理解这个过程,这个过程还是会限制不让用特殊字符吧?
from hub-mirror-action.
@Yikun 是的,数字开头的仓库可以通过 github 导入的方式创建,这样无需修改仓库名,可以绕过无法创建仓库的问题。
特殊字符的话,则只能重命名仓库等其他方式了。一般很少由特殊字符开头的,但是数字开头的有可能。
两个解决方案,在我的仓库的说明中都有指出,暂时没找到其他的解决办法……
from hub-mirror-action.
from hub-mirror-action.
@21ki 那没救了,我会更新文档,我以为官方帮助手册说的可以……不知道是不是最近改了
我问了下 Gitee 的人,表示会更新文档
from hub-mirror-action.
这样刚觉还不错哦
from hub-mirror-action.
想了下,这个需求有一定的用户场景,例如进行blog page同步的时候。
github默认的page服务在repo:xxx.github.io
而gitee默认的page服务在repo:xxx
所以有那种从xxx.github.io到xxx的需求,类似这种:
steps:
- name: Mirror the Github organization repos to Gitee with mapping.
uses: Yikun/hub-mirror-action@master
with:
src: github/xxx
dst: gitee/xxx
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
mapping: "xxx.github.io=xxx"
所以,这个需求会实现的,我再想下这个mapping的规则,看如何更通用一些。
from hub-mirror-action.
我想了种方式,提供fmt,类似python中logger的formatter,经过sed -r $fmt
处理得到dst_repo
例如
steps:
- name: Mirror the Github organization repos to Gitee with mapping.
uses: Yikun/hub-mirror-action@master
with:
src: github/user
dst: gitee/user
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
mapping: fmt='s/(.*)/${SRC_TYPE}_${SRC_ACCOUNT}_\1/g
static_list: 'repo'
目的仓库名输出为github_user_repo
例如
steps:
- name: Mirror the Github organization repos to Gitee with mapping.
uses: Yikun/hub-mirror-action@master
with:
src: github/user
dst: gitee/user
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
mapping: fmt='s/(.*).github.io/\1/g
static_list: 'xxx.github.io'
目的仓库名输出为xxx
不擅长bash,东拼西凑瞎写了下 lol
代码行链接:https://github.com/fakedon/hub-mirror/blob/regex/entrypoint.sh#L240
from hub-mirror-action.
我想了种方式,提供fmt,类似python中logger的formatter,经过sed -r $fmt处理得到dst_repo
@fakedon 这个实现确实是一个不错的思路,确实很通用,技术上满足度很不错。
但个人觉得从用户体验角度看,稍微有些设计过度了。大多数人的需求应该只是类似仓库A到仓库B这种简单的需求,所以,加上sed后,反而比较难用了,用户体验不是很好。
我比较理想的方式是类似:mapping: "{'a':'b', 'c':'d'}"
或者mapping: "a=b, c=d"
当然,类似你这种需求,可能在后续高级特性里面加一下,也不是不可能。
不擅长bash,东拼西凑瞎写了下 lol
事实上,真的有打算拿Python重写。。。立个Flag吧,明年搞定。
另外,代码建议你直接fork,然后,fork后提交,这样后续有需要的同学看看diff也很方便。
有其他的修改,即使是非常小的修改,都可以提交PR。
from hub-mirror-action.
请问这个功能有在推进吗,遇到相同的困惑,希望能支持仓库名称映射。
from hub-mirror-action.
感谢关注,最近抽空搞搞。:)
from hub-mirror-action.
Related Issues (20)
- 同步到gitlab如何使用呢 HOT 2
- 希望可以对自建Gitea进行支持 HOT 3
- 公共仓库间同步失败 HOT 4
- github 仓库同步到 gitee 仓库失败
- 希望可以添加对 sourcehut 的支持
- 希望添加清理缓存的功能 HOT 4
- 希望增加打印已成功仓库日志 HOT 9
- AttributeError: 'Hub' object has no attribute 'src_repo_base' HOT 4
- hub_mirror-action@v运行缓慢 HOT 2
- 为什么运行同步一直在下载系统安装东西,卡十几分钟都不行 HOT 5
- 同步目标源时创建仓库返回502 HOT 1
- 希望增加对codeup的支持
- 同步非private,但是fork的仓库同步如何做? HOT 2
- 应该如何避免总任务超时 HOT 2
- 同步gitee 失败 HOT 1
- error in gitee 同步github HOT 2
- github action处理python包PyYAML报错 HOT 2
- 【HELP】最近失败的频率有点高 HOT 1
- Permission denied (publickey) HOT 4
- 使用 Yikun/hub-mirror-action@master 报错 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hub-mirror-action.