-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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 |