diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index a99116c8a..4eea764c0 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -19,20 +19,11 @@ on: - download - both - status - force_upload: - description: 'Force upload all sources' - required: false - default: false - type: boolean skip_pr: description: 'Skip pull request creation' required: false default: false type: boolean - download_language: - description: 'Download specific language only (optional, e.g., ru, zh_cn)' - required: false - type: string export_approved_only: description: 'Export only approved translations' required: false @@ -56,99 +47,9 @@ permissions: pull-requests: write jobs: - # get-languages: - # runs-on: ubuntu-latest - # outputs: - # languages: ${{ steps.extract-languages.outputs.languages }} - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - - # - name: Validate configuration - # run: | - # echo " Validating Crowdin configuration..." - # if [ ! -f "crowdin.yml" ]; then - # echo " crowdin.yml not found" - # exit 1 - # fi - # echo " Configuration file found" - - # - name: Extract language codes - # id: extract-languages - # run: | - # LANGUAGES=$(yq eval '.files[0].languages_mapping.locale_with_underscore | keys | map(select(. != "en-US" and . != "en-GB" and . != "en"))' crowdin.yml -o json | jq -r '. | map(select(. != null)) | join(" ")') - # echo "languages=[$(echo "$LANGUAGES" | sed 's/[^ ]\+/"&"/g' | sed 's/ /, /g')]" >> $GITHUB_OUTPUT - # echo "Found languages: $LANGUAGES" - - - # download-single: - # if: github.event.inputs.operation == 'download' || github.event.inputs.operation == 'both' || github.event_name == 'schedule' - # needs: get-languages - # strategy: - # matrix: - # language: ${{ fromJson(needs.get-languages.outputs.languages) }} - # fail-fast: false - # runs-on: ubuntu-latest - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - - # - name: Check if language exists - # id: check-language - # run: | - # echo "Checking if language ${{ matrix.language }} exists in project..." - # LANG_EXISTS=$(curl -s -H "Authorization: Bearer ${{ secrets.CROWDIN_TOKEN }}" "https://api.crowdin.com/api/v2/projects/${{ vars.CROWDIN_ID }}/languages" | jq -r '.data[] | select(.data.code == "${{ matrix.language }}") | .data.code') - # if [ -n "$LANG_EXISTS" ]; then - # echo "language_exists=true" >> $GITHUB_OUTPUT - # echo "Language ${{ matrix.language }} found" - # else - # echo "language_exists=false" >> $GITHUB_OUTPUT - # echo "Language ${{ matrix.language }} not found, skipping download" - # fi - - # - name: Download Single Language - # if: steps.check-language.outputs.language_exists == 'true' - # uses: crowdin/github-action@v2.15.0 - # with: - # upload_sources: false - # download_translations: true - # config: crowdin.yml - # download_language: ${{ matrix.language }} - # localization_branch_name: translations - # create_pull_request: false - # skip_untranslated_files: true - # commit_message: "[translation] New translations (${{ matrix.language }})" - # export_only_approved: ${{ github.event.inputs.export_approved_only }} - # dryrun_action: ${{ github.event.inputs.dry_run == 'true' }} - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_TOKEN }} - # CROWDIN_ID: ${{ vars.CROWDIN_ID }} - - upload: - if: github.event.inputs.operation == 'upload' || github.event.inputs.operation == 'both' || github.event_name == 'push' || github.event_name == 'schedule' - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Upload Sources - uses: crowdin/github-action@v2.15.0 - with: - upload_sources: true - upload_translations: false - import_eq_suggestions: true - config: crowdin.yml - dryrun_action: ${{ github.event.inputs.dry_run == 'true' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_TOKEN }} - CROWDIN_ID: ${{ vars.CROWDIN_ID }} - - download: - if: github.event.inputs.skip_pr != 'true' && (github.event.inputs.operation == 'download' || github.event.inputs.operation == 'both' || github.event_name == 'schedule') - needs: [upload] + sync: runs-on: ubuntu-latest + if: github.event.inputs.operation != 'status' steps: - name: Checkout repository uses: actions/checkout@v4 @@ -180,17 +81,16 @@ jobs: - name: Create Pull Request uses: crowdin/github-action@v2.15.0 with: - upload_sources: false + upload_sources: ${{ github.event.inputs.operation == 'upload' || github.event.inputs.operation == 'both' }} upload_translations: false - download_translations: true + import_eq_suggestions: true + download_translations: ${{ github.event.inputs.operation == 'download' || github.event.inputs.operation == 'both' }} config: crowdin.yml localization_branch_name: translations - skip_untranslated_files: true - download_language: ${{ github.event.inputs.download_language }} + create_pull_request: ${{ github.event.inputs.skip_pr != 'true' && (github.event.inputs.operation == 'download' || github.event.inputs.operation == 'both') }} export_only_approved: ${{ github.event.inputs.export_approved_only }} commit_message: "[translation] New translations" dryrun_action: ${{ github.event.inputs.dry_run == 'true' }} - create_pull_request: ${{ github.event.inputs.skip_pr != 'true' }} pull_request_base_branch_name: 'dev' pull_request_team_reviewers: 'modern-team' pull_request_title: "[🌐]: New Crowdin translations"