-
Notifications
You must be signed in to change notification settings - Fork 7
/
action.yml
36 lines (36 loc) · 1.24 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: 'sync-gitee-mirror'
description: '同步 GitHub 仓库到 Gitee 仓库'
inputs:
repository:
description: 'Gitee 仓库,例如 abersheeran/gitee-mirror'
required: true
username:
description: 'Gitee 用户名,用于登录。'
required: true
password:
description: 'Gitee 密码,用于登录。'
required: true
token:
description: 'GitHub 令牌,用于私有仓库的拉取。'
default: ${{ github.token }}
runs:
using: composite
steps:
- run: |
git init
git remote add origin https://github.com/${GITHUB_REPOSITORY}.git
git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n "x-access-token:${{ inputs.token }}" | base64)"
git fetch --all
for branch in `git branch -a | grep remotes | grep -v HEAD`; do
git branch --track ${branch##*/} $branch
done
shell: bash
- run: |
remote_repo="https://${{ inputs.username }}:${{ inputs.password }}@gitee.com/${{ inputs.repository }}.git"
git remote add gitee "${remote_repo}"
git show-ref # useful for debugging
git branch --verbose
# publish all
git push --all --force gitee
git push --tags --force gitee
shell: bash