forked from AzurTian/OnmyojiAutoScript
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (60 loc) · 2.19 KB
/
Copy pathgithub-mirror.yml
File metadata and controls
65 lines (60 loc) · 2.19 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
on:
schedule:
- cron: "0 4 * * *" # 北京时间中午12点 (UTC+8) = UTC 04:00
- cron: "0 10 * * *" # 下午六点
- cron: "0 17 * * *" # 凌晨一点
push:
branches:
- master
name: GitHub-Mirrors
jobs:
run:
name: Run
runs-on: ubuntu-latest
steps:
- name: Get repo and time
id: info
uses: actions/github-script@v3.1
with:
result-encoding: string
script: |
core.setOutput('time', new Date(Date.now()).toISOString().replace(/[^0-9]/g, ""));
core.setOutput('key', `${context.repo.owner}-${context.repo.repo}`);
return context.repo.repo;
- name: Cache src repos
uses: actions/cache@v4
id: cache
with:
path: ${{ github.workspace }}/hub-mirror-cache
key: ${{ runner.os }}-${{ steps.info.outputs.key }}-cache-${{ steps.info.outputs.time }}
restore-keys: ${{ runner.os }}-${{ steps.info.outputs.key }}-cache-
- name: Mirror the GitHub repos to Gitee with cache
uses: Yikun/hub-mirror-action@master
with:
src: github/runhey
dst: gitee/runheng
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # 复用公钥
dst_token: ${{ secrets.GITEE_TOKEN }}
clone_style: ssh
static_list: "${{ steps.info.outputs.result }}"
cache_path: /github/workspace/hub-mirror-cache
account_type: user
force_update: true
white_list: "${{ steps.info.outputs.result }}"
- name: Mirror the GitHub repos to GitCode with cache
uses: Yikun/hub-mirror-action@master
with:
src: github/runhey
dst: gitcode/OnmyojiAutoScript
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # 复用公钥
dst_token: ${{ secrets.GITCODE_TOKEN }}
clone_style: ssh
static_list: "${{ steps.info.outputs.result }}"
cache_path: /github/workspace/hub-mirror-cache
src_account_type: user
dst_account_type: org
force_update: true
white_list: "${{ steps.info.outputs.result }}"
- name: Print cache path
run: |
ls -la ${{ github.workspace }}/hub-mirror-cache