fix #360 #318
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto update translator metadata | |
on: | |
push: | |
branches: | |
- master | |
- test | |
paths: | |
- '*.js' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# copy git 仓库到虚拟机上 | |
- name: 'Checkout codes' | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# fix fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree. | |
- run: git checkout master | |
- name: Install Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 17 | |
# Local via act | |
- name: Install packages for act | |
if: env.ACT == 'true' | |
run: apt update && apt install -y xvfb git rsync | |
- name: Install node packages | |
run: npm ci | |
- name: Update metadata | |
run: | | |
node data/updateJSON.js | |
- name: Commit and push changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: GitHub Actions Bot | |
author_email: [email protected] | |
message: 'commit and push JSON files.' | |
- name: mirror | |
uses: wearerequired/git-mirror-action@master #开源actions包 | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
with: | |
source-repo: "[email protected]:l0o0/translators_CN.git" # github仓库地址 | |
destination-repo: "[email protected]:goonback/translators_CN.git" # gitee仓库地址 |