-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathaction.yml
More file actions
41 lines (37 loc) · 1.23 KB
/
action.yml
File metadata and controls
41 lines (37 loc) · 1.23 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
name: Retrieve *.po and *.pot files from weblate repository
runs:
using: "composite"
steps:
- name: Clone weblate repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}-l10n
path: .l10n
- name: Copy *.po and *.pot files from weblate repository
shell: bash
run: |
pushd .l10n
for component in $(find . -mindepth 1 -maxdepth 1 -type d -not -path './.*'); do
source_path=""
if [ -f "${component}/PATH" ]; then
read -r source_path < "${component}/PATH"
for file in "${component}"/*.{po,pot}; do
if [ -f "$file" ]; then
cp "${file}" "../${source_path}/"
fi
done
git -C .. add "${source_path}"
fi
done
popd
- name: Cleanup the weblate repository
shell: bash
run: |
rm -rf .l10n
- name: Commit *.po and *.pot files
shell: bash
run: |
# only commit if there is any change in translations
if ! git diff --staged --exit-code; then
git -c user.name='GitHub Workflow' -c user.email='[email protected]' commit -m "Update translations from weblate"
fi