<commit_before># This workflow runs every Saturday @ 1900 UTC (NOON PST)
name: i18n download bot
on:
  workflow_dispatch:
  schedule:
    - cron: "0 19 * * 6"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout DIM
        uses: actions/checkout@v2
        with:
          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
          fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

      - name: Inject slug/short variables
        uses: rlespinasse/github-slug-action@v2.x

      - name: Download updated i18n files
        uses: crowdin/github-action@1.0.4
        with:
          upload_sources: false
          upload_translations: false
          download_translations: true
          create_pull_request: false
          push_translations: false
          source: src/locale/dim.json
          translation: src/locale/%android_code%/dim.json
          project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
          token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: sort dim.json
        run: jq -S . src/locale/dim.json > src/locale/dim_sorted.json && mv src/locale/dim_sorted.json src/locale/dim.json

      - name: sort locale dim.json
        run: |
          allLocales=("de" "es" "es-mx" "fr" "it" "ja" "ko" "pl" "pt-br" "ru" "zh-chs" "zh-cht")
          for lang in ${allLocales[@]}; do
            jq -S . src/locale/$lang/dim.json > src/locale/$lang/dim_sorted.json && mv src/locale/$lang/dim_sorted.json src/locale/$lang/dim.json
          done

      - name: Check for new files (DIM)
        id: porcelain
        run: echo ::set-output name=porcelain::"$(git status --porcelain)"

      - name: Commit files
        if: steps.porcelain.outputs.porcelain
        run: |
          git config --local user.email "<EMAIL>"
          git config --local user.name "DIM i18n Bot"
          git config --bool core.bare true
          git commit .
          git commit -m "i18n - ${{ env.GITHUB_SHA_SHORT }}" -a

      - name: Push changes
        if: steps.porcelain.outputs.porcelain
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.I18N_PAT }}<commit_msg>i18n download bot - yarn install etc<commit_after># This workflow runs every Saturday @ 1900 UTC (NOON PST)
name: i18n download bot
on:
  workflow_dispatch:
  schedule:
    - cron: "0 19 * * 6"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout DIM
        uses: actions/checkout@v2
        with:
          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
          fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

      - name: Install Node
        uses: actions/setup-node@v1.4.2
        with:
          node-version: '14.x'

      - name: yarn install
        uses: bahmutov/npm-install@v1

      - name: Inject slug/short variables
        uses: rlespinasse/github-slug-action@v2.x

      - name: Download updated i18n files
        uses: crowdin/github-action@1.0.4
        with:
          upload_sources: false
          upload_translations: false
          download_translations: true
          create_pull_request: false
          push_translations: false
          source: src/locale/dim.json
          translation: src/locale/%android_code%/dim.json
          project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
          token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: sort dim.json
        run: jq -S . src/locale/dim.json > src/locale/dim_sorted.json && mv src/locale/dim_sorted.json src/locale/dim.json

      - name: sort locale dim.json
        run: |
          allLocales=("de" "es" "es-mx" "fr" "it" "ja" "ko" "pl" "pt-br" "ru" "zh-chs" "zh-cht")
          for lang in ${allLocales[@]}; do
            jq -S . src/locale/$lang/dim.json > src/locale/$lang/dim_sorted.json && mv src/locale/$lang/dim_sorted.json src/locale/$lang/dim.json
          done

      - name: Check for new files (DIM)
        id: porcelain
        run: echo ::set-output name=porcelain::"$(git status --porcelain)"

      - name: Commit files
        if: steps.porcelain.outputs.porcelain
        run: |
          git config --local user.email "<EMAIL>"
          git config --local user.name "DIM i18n Bot"
          git commit .
          git commit -m "i18n - ${{ env.GITHUB_SHA_SHORT }}" -a

      - name: Push changes
        if: steps.porcelain.outputs.porcelain
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.I18N_PAT }}
{'fraction_non_alphanumeric': 0.11254495451660673, 'fraction_numerical': 0.01184683731753755, 'mean_word_length': 2.080130293159609, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5436061', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1510, 'n_words': 391}