Skip to content

Commit 65d7631

Browse files
committed
[Rahu] | BAH-3644 | Add. Workflow To Pull Translations
This workflow is designed to retrieve translations from Transifex once every month in case resources are updated.
1 parent f28af70 commit 65d7631

File tree

3 files changed

+56
-5
lines changed

3 files changed

+56
-5
lines changed

.github/scripts/transifex.sh

+12-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,20 @@ if [ ! -f .tx/config ]; then
1515
exit 1
1616
fi
1717

18-
echo "Pushing translation source file to Transifex..."
19-
tx push -s
18+
if [ "$1" == "push" ]; then
19+
echo "Pushing translation source file to Transifex..."
20+
tx push -s
21+
elif [ "$1" == "pull" ]; then
22+
echo "Pulling translations from Transifex..."
23+
tx pull -t -s --mode reviewed --use-git-timestamps
24+
else
25+
echo "Invalid operation. Please specify either 'push' or 'pull'."
26+
exit 1
27+
fi
2028

2129
if [ $? -ne 0 ]; then
22-
echo "Error: Transifex push failed. Please check the error message above."
30+
echo "Error: Transifex operation failed. Please check the error message above."
2331
exit 1
2432
else
25-
echo "Translation source file successfully pushed to Transifex."
33+
echo "Transifex operation completed successfully."
2634
fi

.github/workflows/build_upload.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
tags: bahmni/clinic-config:${{env.ARTIFACT_VERSION}},bahmni/clinic-config:latest
4343
- name: Push Translations to Transifex
4444
run: |
45-
bash .github/scripts/transifex.sh
45+
bash .github/scripts/transifex.sh push
4646
env:
4747
TX_TOKEN: ${{ secrets.TX_TOKEN }}
4848
- name: Pull Bahmni Default Config Helm Chart
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Pull Translations from Transifex
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 1 * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
pull-translations:
10+
name: Pull Translations from Transifex
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Pull Translations from Transifex
20+
run: |
21+
bash .github/scripts/transifex.sh pull
22+
env:
23+
TX_TOKEN: ${{ secrets.TX_TOKEN }}
24+
25+
- name: Commit and push changes
26+
id: auto-commit-action
27+
uses: stefanzweifel/git-auto-commit-action@v4
28+
with:
29+
commit_message: "[Bahmni Infra] | Add. Update Translation Resources"
30+
branch: ${{ github.ref }}
31+
file_pattern: 'openmrs/i18n/**/*.json'
32+
repository: .
33+
commit_user_name: Bahmni Infra
34+
commit_user_email: infrastructure@bahmni.org
35+
commit_author: bahmni-infra <infrastructure@bahmni.org>
36+
37+
- name: Check for changes
38+
run: |
39+
if [[ steps.auto-commit-action.outputs.changes_detected == 'true' ]]; then
40+
echo "Changes Detected. Translation Resources Updated."
41+
else
42+
echo "No Changes Detected. Project Already Up-To-Date."
43+
fi

0 commit comments

Comments
 (0)