-
Notifications
You must be signed in to change notification settings - Fork 10
48 lines (42 loc) · 1.56 KB
/
github-to-coding.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
47
48
# Coding OpenAPI: https://help.coding.net/openapi
name: GitHub to Coding
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 -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 Coding
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: e.coding.com/k8scat
dest_username: ${{ secrets.CODING_PROJECT_NAME }}
dest_token: ${{ secrets.DEST_TOKEN_CODING }}
dest_token_username: k8scat
mirror_repos: ${{ steps.list_repos.outputs.repo_list }}
dest_create_repo_script: |
curl \
-H 'Content-Type: application/json' \
-d "{\"Action\":\"CreateGitDepot\",\"ProjectId\":${{ secrets.CODING_PROJECT_ID }},\"DepotName\":\"${REPO_NAME}\"}" \
https://e.coding.net/open-api
lark_webhook: ${{ secrets.LARK_WEBHOOK }}
notify_prefix: "GitHub to Coding"
ignore_error: "true"