Skip to content

Commit a852045

Browse files
authored
ACTIONS/tr-update: add auto-update for Translation (#108)
cron 1-day in a week
1 parent 076174d commit a852045

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/tr-update.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
name: Update translations (Miyoo)
3+
4+
on:
5+
# Run nightly: 8am UTC (only on Saturday) <- use POSIX cron syntax
6+
schedule:
7+
- cron: '0 8 * * 6'
8+
# Or run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
jobs:
12+
build-native:
13+
name: Nightly Translations update (miyoo)
14+
# only run on the main repo; forks can pull changes from there
15+
if: ${{ github.repository == 'MiyooCFW/gmenu2x' }}
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
token: ${{ secrets.GH_PAT }}
21+
- name: install dependencies (unifdef)
22+
run: |
23+
sudo apt-get update \
24+
&& sudo apt-get install unifdef
25+
- name: update dictionary.txt
26+
run: |
27+
(grep -o -rn . -P -e "\ttr\["[^]]*"\]" ; \
28+
grep -o -rn . -e '>tr\["[^]]*"\]\|(tr\["[^]]*"\]\|\+tr\["[^]]*"\]\|\ tr\["[^]]*"\]\|,tr\["[^]]*"\]') | \
29+
sed 's/.*\[\(.*\)\].*/\1/' | \
30+
sed 's/\"\(.*\)\"/\1=/' | \
31+
sed ':a;N;$!ba;s/\\n/ /g' | \
32+
tr -d '\\' | sort | uniq \
33+
> dictionary.txt
34+
- name: update translate.txt (miyoo)
35+
run: |
36+
./tools/gen_translate.sh miyoo_defines miyoo
37+
- name: clean & update ALL ./assets/translations/*
38+
run: |
39+
./tools/clean_translations.sh ALL
40+
- name: Check for git status
41+
id: status
42+
run: |
43+
echo "changes=$(git status -z --porcelain)" >> $GITHUB_OUTPUT
44+
- name: Push update changes
45+
if: ${{ steps.status.outputs.changes }}
46+
run: |
47+
git config user.email "action@github.com"
48+
git config user.name "GitHub Actions"
49+
git status
50+
git commit -am "Update Translations' files $(date)"
51+
git push

0 commit comments

Comments
 (0)