-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsync2gitee.cached.yml
51 lines (46 loc) · 1.76 KB
/
sync2gitee.cached.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
49
50
51
name: sync2gitee(cached)
# version: 1.3.2
# author: [yiXu](https://github.com/yi-Xu-0100)
# guide: [yi-Xu-0100/hub-mirror](https://github.com/yi-Xu-0100/hub-mirror)
# template: [sync2gitee.cached.yml](https://github.com/yi-Xu-0100/hub-mirror/blob/main/template/sync2gitee.cached.yml)
# lastmod: 2021-02-02 10:23:30
on:
push:
schedule:
# UTC 17:00 -> CST (China) 1:00 see https://datetime360.com/cn/utc-cst-china-time/
- cron: '0 17 * * *'
jobs:
run:
name: Sync GitHub to Gitee(Cached)
runs-on: ubuntu-latest
steps:
- name: Get repo and time
id: info
uses: actions/[email protected]
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/[email protected]
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/[email protected]
with:
src: github/yi-Xu-0100
dst: gitee/yiXu0100
dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
dst_token: ${{ secrets.GITEE_TOKEN }}
static_list: '${{ steps.info.outputs.result }}'
cache_path: /github/workspace/hub-mirror-cache
account_type: user
force_update: true
- name: Print cache path
run: |
ls -la ${{ github.workspace }}/hub-mirror-cache