name: Crowdin Action
on:
  workflow_dispatch:
  schedule:
    - cron: '2 */12 * * *'
  push:
    paths: ['src/locale/**', 'src-ui/messages.xlf', 'src-ui/src/locale/**']
    branches: [dev]
jobs:
  synchronize-with-crowdin:
    name: Crowdin Sync
    if: github.repository_owner == 'paperless-ngx'
    runs-on: ubuntu-24.04
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          token: ${{ secrets.PNGX_BOT_PAT }}
      - name: crowdin action
        uses: crowdin/github-action@v2
        with:
          upload_translations: false
          download_translations: true
          crowdin_branch_name: 'dev'
          localization_branch_name: l10n_dev
          pull_request_labels: 'skip-changelog, translation'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
