Skip to content
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 doc for mappings #114

Merged
merged 3 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ steps:
- `static_list` 默认为'', 配置后,仅同步静态列表,不会再动态获取需同步列表(黑白名单机制依旧生效),如“repo1,repo2,repo3”。
- `force_update` 默认为false, 配置后,启用git push -f强制同步,**注意:开启后,会强制覆盖目的端仓库**。
- `debug` 默认为false, 配置后,启用debug开关,会显示所有执行命令。
- `timeout` 默认为'30m', 用于设置每个git命令的超时时间,'600'=>600s, '30m'=>30 mins, '1h'=>1 hours
- `mappings` 源仓库映射规则,比如'A=>B, C=>CC', A会被映射为B,C会映射为CC,映射不具有传递性。主要用于源和目的仓库名不同的镜像。

## 举些例子

Expand Down Expand Up @@ -142,6 +144,19 @@ steps:
timeout: '1h'
```

#### 仓库名不同时同步(github/yikun/yikun.github.com to gitee/yikunkero/blog)
```
- 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 }}
mappings: "yikun.github.com=>blog"
static_list: "yikun.github.com"
```

## FAQ

- 如何在secrets添加dst_token和dst_key?
Expand Down
15 changes: 15 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Here is a workflow to mirror the kunpengcompute org repos from Github to Gitee,
- `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'
- `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.

## Scenarios

Expand Down Expand Up @@ -129,6 +131,19 @@ Here is a workflow to mirror the kunpengcompute org repos from Github to Gitee,
timeout: '1h'
```

#### Sync between different repo name(github/yikun/yikun.github.com to gitee/yikunkero/blog)
```
- 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 }}
mappings: "yikun.github.com=>blog"
static_list: "yikun.github.com"
```

## FAQ
- How to use `secrets` to add token and key?

Expand Down