<commit_before># This workflow imports translations from Launchpad

name: Translations import
on:
  schedule:
  # Runs at 10PM PST
  - cron: '0 6 * * *'

jobs:
  import:
    runs-on: ubuntu-latest

    env:
      BAZAAR_URI: lp:~kennyr/connectbot/po-output
      PO_SUBDIR: app/locale

    steps:
    - uses: actions/checkout@v2

    - name: Install bazaar
      run: |
        sudo apt-get update && \
        sudo apt-get install -y --no-install-recommends \
            bzr \
            ca-certificates \
            rsync

    - name: Branch Bazaar translation exports
      run: |
        cd ${{ runner.temp }}
        bzr branch lp:~kennyr/connectbot/po-output
        cd po-output
        echo "REVNO=$(bzr revno)" >> $GITHUB_ENV

    - name: Copy exported translations to workspace
      run: |
        rsync -av --exclude .bzr --exclude '**/oc.po' --exclude '**/ca<EMAIL>.po' \
            "${{ runner.temp }}/${BAZAAR_URI##*/}/" "${GITHUB_WORKSPACE}/${PO_SUBDIR}/"
        echo $REVNO > "${GITHUB_WORKSPACE}/${PO_SUBDIR}/.revno"

    - name: Try importing the translations
      run: |
        TRANSLATIONS_ONLY=1 ./gradlew :translations:importToAndroid

    - name: Create pull request
      uses: peter-evans/create-pull-request@v3.10.0
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        COMMIT_MESSAGE: |
          Automated translations import

          Translations imported from Launchpad.
        COMMIT_AUTHOR_EMAIL: <EMAIL>
        COMMIT_AUTHOR_NAME: Translations Bot
        PULL_REQUEST_TITLE: '[Translations] Automatic update'
        PULL_REQUEST_BODY: |
          Automated import of translations from Launchpad.
        PULL_REQUEST_LABELS: translations, automated pr
        PULL_REQUEST_ASSIGNEES: kruton
        PULL_REQUEST_REVIEWERS: kruton
        PULL_REQUEST_BRANCH: translations/import
        BRANCH_SUFFIX: none

    - name: Report pull request creation
      run: echo "Created pull request number ${{ env.PULL_REQUEST_NUMBER }}"<commit_msg>Update translations-import.yml<commit_after># This workflow imports translations from Launchpad

name: Translations import
on:
  schedule:
  # Runs at 10PM PST
  - cron: '0 6 * * *'

jobs:
  import:
    runs-on: ubuntu-latest

    env:
      BAZAAR_URI: lp:~kennyr/connectbot/po-output
      PO_SUBDIR: app/locale

    steps:
    - uses: actions/checkout@v2

    - name: Install bazaar
      run: |
        sudo apt-get update && \
        sudo apt-get install -y --no-install-recommends \
            bzr \
            ca-certificates \
            rsync

    - name: Branch Bazaar translation exports
      run: |
        cd ${{ runner.temp }}
        bzr branch lp:~kennyr/connectbot/po-output
        cd po-output
        echo "REVNO=$(bzr revno)" >> $GITHUB_ENV

    - name: Copy exported translations to workspace
      run: |
        rsync -av --exclude .bzr --exclude '**/oc.po' --exclude '**/ca@valencia.po' \
            "${{ runner.temp }}/${BAZAAR_URI##*/}/" "${GITHUB_WORKSPACE}/${PO_SUBDIR}/"
        echo $REVNO > "${GITHUB_WORKSPACE}/${PO_SUBDIR}/.revno"

    - name: Try importing the translations
      run: |
        TRANSLATIONS_ONLY=1 ./gradlew :translations:importToAndroid

    - name: Create pull request
      uses: peter-evans/create-pull-request@v3.10.0
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        commit-message: |
          Automated translations import

          Translations imported from Launchpad.
        author: Translations Bot <<EMAIL>>
        title: '[Translations] Automatic update'
        body: |
          Automated import of translations from Launchpad.
        labels: translations, automated pr
        assignees: kruton
        reviewers: kruton
        branch: translations/import

    - name: Report pull request creation
      run: echo "Created pull request number ${{ env.PULL_REQUEST_NUMBER }}"
{'fraction_non_alphanumeric': 0.10605276771857217, 'fraction_numerical': 0.005173305742369374, 'mean_word_length': 2.2605396290050592, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7307804', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1204, 'n_words': 298}