diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 000000000..829b66e49 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,55 @@ +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 + +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 + + - 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: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + commit-message: "Update fa translations from Transifex" + title: "Sync translations from Transifex" + body: | + This PR updates Persian (fa) translations from Transifex. + - Pulls reviewed translations only + - Auto-generated by GitHub Actions + branch: update-translations + delete-branch: true \ No newline at end of file