-
Notifications
You must be signed in to change notification settings - Fork 524
45 lines (42 loc) · 1.23 KB
/
main.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
name: Auto update translator metadata
on:
push:
branches:
- master
- test
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# copy git 仓库到虚拟机上
- name: 'Checkout codes'
uses: actions/checkout@v3
- name: Git init
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git clean -f # Remove untrack file
- name: Update metadata
id: update_metadata
run: |
python metadata.py
- name: check update
id: modified
run: |
counts=`git status | grep "data/translators.json" | wc -l`
echo "counts=${counts}" >> $GITHUB_ENV
- name: Update and mirror
if: env.counts == 1
run: |
git status
echo ${{ env.counts }}
git add data/translators.json
git commit -m 'update translator metadata'
git push
- uses: wearerequired/git-mirror-action@master #开源actions包
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
with:
source-repo: "git@github.com:l0o0/translators_CN.git" # github仓库地址
destination-repo: "git@gitcode.net:goonback/translators_CN.git" # gitee仓库地址