Skip to content

Commit

Permalink
Github action to retrieve translations from weblate
Browse files Browse the repository at this point in the history
This action clones weblate repository, retrieves fresh translations from
it and commits the changes.
  • Loading branch information
m-blaha committed Nov 10, 2023
1 parent f6948e9 commit af3a896
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/actions/weblate-pull-translations/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Retrieve *.po 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 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 po in "${component}"/*.po; do
if [ -f "$po" ]; then
cp "${po}" "../${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 files
shell: bash
run: |
git -c user.name='GitHub Workflow' -c user.email='[email protected]' commit -m "Update translations from weblate"

0 comments on commit af3a896

Please sign in to comment.