-
-
Notifications
You must be signed in to change notification settings - Fork 115
54 lines (45 loc) · 1.5 KB
/
sync_from_weblate.yml
File metadata and controls
54 lines (45 loc) · 1.5 KB
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
46
47
48
49
50
51
52
53
54
name: Filter and sync translations from Weblate to main
on:
push:
branches:
- weblate
workflow_dispatch:
jobs:
filter-and-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: beta
fetch-depth: 0
token: ${{ secrets.PUSH_TOKEN }}
- name: Configure Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Checkout weblate branch content to temp dir
run: |
git worktree add ../weblate_tmp origin/weblate
- name: Install dependencies
run: |
pip3 install lxml aiohttp_retry aiohttp
- name: Run filter script on weblate_tmp directory
run: |
INPUT_DIR="../weblate_tmp"
MAIN_BRANCH="beta"
./filter_translations "$(realpath $INPUT_DIR)"
git checkout $MAIN_BRANCH -- app/src/main/res/values/strings.xml fastlane/metadata/android/en-US
env:
WEBLATE_TOKEN: ${{ secrets.WEBLATE_TOKEN }}
- name: Clean up temp directory
run: |
git worktree remove ../weblate_tmp
- name: Commit and push changes if any
run: |
git add -A
WEBLATE_HASH=$(git rev-parse origin/weblate)
if ! git diff --quiet HEAD; then
git commit -m "Filtered translations from $WEBLATE_HASH"
git push
fi