Skip to content

Commit

Permalink
Add clone style support (#12)
Browse files Browse the repository at this point in the history
You can choose 'ssh' or 'https' (default) to git clone your repo!
  • Loading branch information
Yikun authored Mar 10, 2020
1 parent 0cb88ac commit e2d8722
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Hub Mirror Action

English | [简体中文](./README_CN.md)

The action to mirror the organization repos between hub(github/gitee).

# Usage
Expand Down
7 changes: 4 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ You could take a look on the [verify workflow](https://github.com/Yikun/hub-mirr
- `src` 需要被同步的源端账户名,例如Github的kunpengcompute组织,为github/kunpengcompute。
- `dst` 需要同步到的目的端账户名,例如Gitee的kunpengcompute组织,为gitee/kunpengcompute。
- `account_type` 源和目的的账户类型,可以设置为org(组织)或者user(用户),目前仅支持同类型账户的同步。
- `dst_key` 用于目的端上传代码的SSH key,Github可以在[这里](https://gitee.com/profile/sshkeys)找到,Gitee可以[这里](https://github.com/settings/keys)找到
- `dst_token` 用于创建仓库的API tokens,Github可以在[这里](https://github.com/settings/tokens)找到,Gitee可以在[这里](https://gitee.com/profile/personal_access_tokens)找到
- `dst_key` 用于目的端上传代码的SSH key,用于上传代码,Github可以在[这里](https://gitee.com/profile/sshkeys)找到,Gitee可以[这里](https://github.com/settings/keys)找到
- `dst_token` 创建仓库的API tokens, 用于自动创建不存在的仓库,Github可以在[这里](https://github.com/settings/tokens)找到,Gitee可以在[这里](https://gitee.com/profile/personal_access_tokens)找到。
- `account_type` 可选参数,默认为user,源和目的的账户类型,可以设置为org(组织)或者user(用户),目前仅支持同类型账户的同步。
- `clone_style` 可选参数,默认为https,可以设置为ssh或者https。

### 快速启用指南
```yaml
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ inputs:
account_type:
description: "The account type. Such as org, user."
default: 'user'
clone_style:
description: "The git clone style, https or ssh."
default: 'https'
runs:
using: "docker"
image: "Dockerfile"
Expand All @@ -29,3 +32,4 @@ runs:
- ${{ inputs.src }}
- ${{ inputs.dst }}
- ${{ inputs.account_type }}
- ${{ inputs.clone_style }}
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DST_TYPE=`dirname $DST_HUB`
SRC_ACCOUNT=`basename $SRC_HUB`
DST_ACCOUNT=`basename $DST_HUB`

CLONE_STYLE="ssh"
CLONE_STYLE="${INPUT_CLONE_STYLE}"

if [[ "$ACCOUNT_TYPE" == "org" ]]; then
SRC_LIST_URL_SUFFIX=orgs/$SRC_ACCOUNT/repos
Expand Down

0 comments on commit e2d8722

Please sign in to comment.