Skip to content

Commit 1ffe930

Browse files
committed
ci: sync stable branch translations
Only main branch will be localized by Transifex. To also update the stable branch with translations we need to synchronize them. This actions does following: - clone both branches - combine po files from both branches for each language - check the stable branch po template which messages are needed - copy needed messaged from the combined po file (use the main if the translation differ) Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 08a4565 commit 1ffe930

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/sync-l10n.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: MIT
3+
4+
name: Sync stable branch translations
5+
6+
on:
7+
workflow_dispatch:
8+
schedule:
9+
- cron: "0 5 * * *"
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
server-styling-update:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout main
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
with:
22+
path: main
23+
24+
- name: Checkout stable branch
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
with:
27+
path: stable-branch
28+
ref: stable8
29+
30+
- name: Merge translations
31+
run: |
32+
cd "$GITHUB_WORKSPACE"
33+
# combine entries
34+
mkdir merged-entries
35+
for f in stable-branch/l10n/*.pot; do
36+
[ "$f" = "messages.pot" ] && continue
37+
msgcat -o "merged-entries/$(basename $f)" --use-first "main/l10n/$(basename $f)" "$f"
38+
done
39+
# update the stable one with all needed translations
40+
for f in merged-entries/*.pot; do
41+
msgmerge -N "$f" "stable-branch/l10n/messages.pot" > "stable-branch/l10n/$(basename $f)"
42+
done
43+
44+
- name: Create Pull Request
45+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
46+
with:
47+
path: stable-branch
48+
token: ${{ secrets.COMMAND_BOT_PAT }}
49+
commit-message: "chore(l10n): sync translations with main branch"
50+
committer: GitHub <noreply@github.com>
51+
author: nextcloud-command <nextcloud-command@users.noreply.github.com>
52+
signoff: true
53+
branch: automated/noid/stable-translations-update
54+
title: 'Automated merge of translations'
55+
add-paths: l10n
56+
body: |
57+
Auto-generated merge of the translations from main branch.
58+
labels: |
59+
3. to review
60+
l10n

0 commit comments

Comments
 (0)