-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add private or public for create repo #152
Conversation
Thanks for you contributions! But in my opinion, this kind of breaks the semantics of synchronization. Could you share your real case? Let's see why we need this parameter. I guess you just want backup your repos but don't want dispaly these repos in your dst hub? |
also cc @yi-Xu-0100 @ShixiangWang @JasonkayZK What do you think? |
@Yikun Thanks for cc me. Currently I don't have such demands. From the file change, it seems that it would not change default behavior. I agree with you that if a real case can be estimated, it's worthy to have this new option. |
hub-mirror/hub.py
Outdated
@@ -62,7 +63,7 @@ def create_dst_repo(self, repo_name): | |||
if self.dst_type == 'gitee': | |||
data = {'name': repo_name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess here is my bad before, looks like we could use this in gitee params directly?
README.md
Outdated
@@ -50,7 +50,7 @@ steps: | |||
- `debug` 默认为false, 配置后,启用debug开关,会显示所有执行命令。 | |||
- `timeout` 默认为'30m', 用于设置每个git命令的超时时间,'600'=>600s, '30m'=>30 mins, '1h'=>1 hours | |||
- `mappings` 源仓库映射规则,比如'A=>B, C=>CC', A会被映射为B,C会映射为CC,映射不具有传递性。主要用于源和目的仓库名不同的镜像。 | |||
|
|||
- `dst_private` 默认为false,配置后,如果gitee仓库不存在,则创建公开仓库,否则创建私有仓库 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `dst_private` 默认为false,配置后,如果gitee仓库不存在,则创建公开仓库,否则创建私有仓库 | |
- `dst_visibility` 默认为public,配置为priavte,意味着新创建的仓将默认的设置为私有仓,已存在的仓库则只会进行同步。 |
- there are some inconsistent behavior for new creating repo and existing repo, this might not a good enough API for me.
dst_private
is also not a clear name.
hub-mirror/hub.py
Outdated
@@ -62,7 +63,7 @@ def create_dst_repo(self, repo_name): | |||
if self.dst_type == 'gitee': | |||
data = {'name': repo_name} | |||
elif self.dst_type == 'github': | |||
data = json.dumps({'name': repo_name}) | |||
data = json.dumps({'name': repo_name,'private': self.dst_private}) | |||
if not self.has_dst_repo(repo_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a side note, when second round sync triggered, we can't get this dst private repo, if we enable this private parameter, we will always failed to create the private repo and print Destination repo creating failed:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have similar problems, I now have several private repositories that are github synced to gitee's private repositories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dislazy Could you share your workflow yaml link in here? : )
@yi-Xu-0100 this is not for private repo mirror, it's just for sync public repo as private repo. So let's see the real case from author. I've heard more than once that wishing the private should be supported, Looks like we should consider supporting private repo mirror. : ) |
Hello everyone, my main purpose is to achieve mutual backup between github and gitee. If the github repository is private, then if the repository synchronized by gitee is not private, some key information will be leaked. |
@dislazy But private repo mirror haven't been supported yet, we can only get the public repos from src repo list: hub-mirror-action/hub-mirror/hub.py Line 107 in 123860d
that means hub-mirror only supports public mirror now.
So, this assumation might be wrong? |
As such, yes, but you can continue to optimize |
@dislazy See related commentes in here: #38 (comment) Could rename |
README_en.md
Outdated
@@ -47,6 +47,7 @@ More than [100+](https://github.com/search?p=2&q=hub-mirror-action+%22account_ty | |||
- `force_update` (optional) Force to update the destination repo, use '-f' flag do 'git push' | |||
- `timeout` (optional) Default is '30m', set the timeout for every git command, like '600'=>600s, '30m'=>30 mins, '1h'=>1 hours | |||
- `mappings` (optional) Default is empty, the source repos mappings, such as 'A=>B, C=>CC', source repo name would be mapped follow the rule: A to B, C to CC. Mapping is not transitive. | |||
- `dst_private` (optional) Default is false. After configuration, if the gitee repository does not exist, create a public repository, otherwise create a private repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `dst_private` (optional) Default is false. After configuration, if the gitee repository does not exist, create a public repository, otherwise create a private repository | |
- `dst_private` (optional) Default is public. If set to `private`, new creating repo visibility is `private`, but if destination repo have been created, the repo visibility will not be set, just only update the repo. |
hub-mirror/hub.py
Outdated
@@ -7,7 +7,7 @@ | |||
|
|||
class Hub(object): | |||
def __init__( | |||
self, src, dst, dst_token, account_type="user", | |||
self, src, dst, dst_token,dst_private, account_type="user", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pep8 failed
I added the comments according latest desigin. |
ping |
add private or public for create repo