|
| 1 | +name: Crowdin Download Action |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run every day at 1 AM UTC |
| 6 | + - cron: "0 1 * * *" |
| 7 | + workflow_dispatch: # Manual triggering |
| 8 | + inputs: |
| 9 | + language_code: |
| 10 | + description: 'Language code to download translations for (leave empty to download all languages)' |
| 11 | + required: false |
| 12 | + default: '' |
| 13 | + type: string |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: crowdin-download |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +permissions: write-all |
| 20 | + |
| 21 | +jobs: |
| 22 | + crowdin: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Skip if Crowdin ID missing |
| 26 | + run: | |
| 27 | + if [ -z "${{ secrets.CROWDIN_PROJECT_ID }}" ]; then |
| 28 | + echo "Skipping Crowdin sync — no project ID set." |
| 29 | + exit 0 |
| 30 | + fi |
| 31 | +
|
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + ref: master |
| 36 | + |
| 37 | + - name: Download all translations from Crowdin |
| 38 | + uses: crowdin/github-action@v2 |
| 39 | + with: |
| 40 | + create_pull_request: true |
| 41 | + crowdin_branch_name: master |
| 42 | + download_translations: true |
| 43 | + localization_branch_name: l10n_crowdin_translations |
| 44 | + pull_request_base_branch_name: "master" |
| 45 | + pull_request_body: "New Crowdin pull request with translations" |
| 46 | + pull_request_title: "New Crowdin translations" |
| 47 | + upload_sources: false |
| 48 | + upload_translations: false |
| 49 | + env: |
| 50 | + CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} |
| 51 | + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} |
| 52 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + if: ${{ inputs.language_code == '' }} |
| 54 | + |
| 55 | + - name: Download selected translations from Crowdin |
| 56 | + uses: crowdin/github-action@v2 |
| 57 | + with: |
| 58 | + create_pull_request: true |
| 59 | + crowdin_branch_name: master |
| 60 | + download_language: ${{ inputs.language_code }} |
| 61 | + download_translations: true |
| 62 | + localization_branch_name: l10n_crowdin_translations-${{ inputs.language_code }} |
| 63 | + pull_request_base_branch_name: "master" |
| 64 | + pull_request_body: "New Crowdin pull request with translations" |
| 65 | + pull_request_title: "New Crowdin translations for ${{ inputs.language_code }}" |
| 66 | + upload_sources: false |
| 67 | + upload_translations: false |
| 68 | + env: |
| 69 | + CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} |
| 70 | + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} |
| 71 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + if: ${{ inputs.language_code != '' }} |
| 73 | + |
0 commit comments