Skip to content

Commit

Permalink
workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
garywill committed Jan 28, 2024
1 parent f565ade commit e4a17e3
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/sync_opencc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Sync with OpenCC

on:
schedule:
- cron: '0 4 2 * *'
# * is a special character in YAML so you have to quote this string


workflow_dispatch:



jobs:
my_first_job_id:
name: Sync with OpenCC
runs-on: ubuntu-latest
steps:
- name: Job's checkout
uses: actions/checkout@master

- name: Show some info and switch branch
run: |
pwd
ls -la
git branch -a
git fetch origin main
git branch -a
git config user.name bot
git config user.email bot@github.bot.none
git config --list
env
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Run the bash
run: bash sync_opencc.sh
56 changes: 56 additions & 0 deletions sync_opencc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

#uname -a
#pwd
#ls -la
#git branch -a
#git config --list
#git fetch origin main
git checkout main
git checkout .
git branch -a
#ls -la
#git log


opencc_file_list=(
HKVariants.txt
JPVariants.txt
STCharacters.txt
TSCharacters.txt
TWVariants.txt
)

for ((i=0; i<${#opencc_file_list[@]}; i++ ))
do
sha1sum opencc-data/${opencc_file_list[i]}
wget https://raw.githubusercontent.com/BYVoid/OpenCC/master/data/dictionary/${opencc_file_list[i]} -O opencc-data/${opencc_file_list[i]} || exit 1
#curl https://raw.githubusercontent.com/BYVoid/OpenCC/master/data/dictionary/${opencc_file_list[i]} > opencc-data/${opencc_file_list[i]}


git config user.name bot
git config user.email bot@github.bot.none

sha1sum opencc-data/${opencc_file_list[i]}
git add opencc-data/${opencc_file_list[i]}
git diff
git commit -m "sync opencc ${opencc_file_list[i]}"
#git log

done

pushd .
cd opencc-data
node pre.js || exit 1
git add -u opencc-data-*.js
git commit -m "run opencc pre.js"
popd

pushd .
cd summary-data
node pre.js || exit 1
git add -u summary-data-*.js
git commit -m "run summary pre.js"
popd

git push

0 comments on commit e4a17e3

Please sign in to comment.