forked from k8scat/action-mirror-git
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (41 loc) · 1.47 KB
/
github-to-bitbucket.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
37
38
39
40
41
42
43
44
45
46
name: GitHub to BitBucket
on:
workflow_dispatch:
schedule:
- cron: "0 2 * * 3"
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login Source GitHub
run: |
gh --version
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
gh auth status
- name: List repos
id: list_repos
run: |
repo_list=$(gh repo list k8scat -L 1000 --json name -t '{{range $i, $n := .}}{{if (gt $i 0)}},{{end}}{{$n.name}}{{end}}')
echo "::set-output name=repo_list::${repo_list}"
- name: GitHub to BitBucket
uses: k8scat/[email protected]
with:
source_protocol: https
source_host: github.com
source_username: k8scat
source_token: ${{ secrets.GITHUB_TOKEN }}
dest_protocol: https
dest_host: bitbucket.org
dest_username: k8scat
dest_token: ${{ secrets.DEST_TOKEN_BITBUCKET }}
mirror_repos: ${{ steps.list_repos.outputs.repo_list }}
dest_create_repo_script: |
curl \
-u "${INPUT_DEST_USERNAME}:${INPUT_DEST_TOKEN}" \
-H 'Content-Type: application/json' \
-d '{"scm":"git"}' \
"https://api.bitbucket.org/2.0/repositories/${INPUT_DEST_USERNAME}/${REPO_NAME}"
lark_webhook: ${{ secrets.LARK_WEBHOOK }}
notify_prefix: "GitHub to BitBucket"
ignore_error: "true"