Skip to content

Commit

Permalink
Workflow for *.po retrieval from weblate
Browse files Browse the repository at this point in the history
  • Loading branch information
m-blaha committed Nov 8, 2023
1 parent 3febf5e commit b90bd51
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/weblate-sync-po.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Weblate - retrieve translations
on:
schedule:
# Run every monday morning
- cron: '30 3 * * 1'
workflow_dispatch:

jobs:
po-refresh:
name: Retrieve *.po files from dnf5-l10n repository
environment: self
permissions:
pull-requests: write
statuses: write
runs-on: ubuntu-latest
steps:
- name: Clone source repository
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.L10N_SSH_KEY }}
path: src

- name: Clone weblate repository
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}-l10n
path: l10n

- name: Prepare a new branch
run: git -C src checkout -b weblate-sync-$(date +"%Y-%m-%d-%H-%M-%S")

- name: Copy .po files from weblate repository
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}" "../src/${source_path}/"
fi
done
fi
done
popd
- name: Create a pull request
run: |
git config --global user.name "GitHub Workflow"
git config --global user.email "[email protected]"
pushd src
gh pr create -B main --title 'Update translations from Fedora Weblate' --body 'Created by Github action'
popd

0 comments on commit b90bd51

Please sign in to comment.