-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathsync.yml.disabled
More file actions
60 lines (49 loc) · 1.78 KB
/
Copy pathsync.yml.disabled
File metadata and controls
60 lines (49 loc) · 1.78 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: "Sync Translations"
on:
schedule:
- cron: '0 0 * * *' # Run daily at midnight
workflow_dispatch: # Allow manual triggers
pull_request:
types: [labeled] # Trigger on PR label
permissions:
contents: write
pull-requests: write
jobs:
sync-translations:
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event.label.name == 'sync-translations'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Transifex CLI
run: |
cd /usr/local/bin
sudo curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gettext
pip install transifex-python sphinx-intl polib powrap
- name: Sync with Transifex
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
run: |
# Pull reviewed translations from Transifex
tx pull -f -l fa --mode=reviewed
# Format .po files
find . -name "*.po" -exec msgcat --no-wrap {} -o {} \;
- name: Format PO files
run: |
find . -name "*.po" -exec powrap {} \;
- name: Commit and push changes
if: github.event_name != 'pull_request'
run: |
git config --local user.name "GitHub Action's update-translation job"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Update Farsi translations from Transifex" || echo "No changes to commit"
git push