transifex / transifex-client

The Transifex command-line tool.
https://www.transifex.com/
GNU General Public License v2.0
135 stars 75 forks source link

No useful output from `tx pull` #329

Open brandones opened 3 years ago

brandones commented 3 years ago

I'm trying to set up a GitHub Action which uses tx pull to update translations. Here is the action:

name: Update translation files from Transifex 

on:
  schedule:
    - cron: '36 0 * * *'
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      TX_TOKEN: ${{ secrets.TRANSIFEX_API_TOKEN }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
      - run: python -m pip install --upgrade pip
      - run: pip install transifex-client
      - run: tx init --force --no-interactive --traceback
      - run: tx pull -a --minimum-perc=1 --traceback --debug
      - uses: EndBug/add-and-commit@v7
        with:
          add: app/js/translations
          message: 'Update translations'

I'm testing it out using Act. I'm seeing the following output for the tx parts:

[Update translation files from Transifex/build] ⭐  Run tx init --force --no-interactive --traceback
[Update translation files from Transifex/build]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/brandon/Code/pih/openmrs-owa-orderentry/workflow/4] user=
| 
|  _____                    _  __
| |_   _| __ __ _ _ __  ___(_)/ _| _____  __
|   | || '__/ _` | '_ \/ __| | |_ / _ \ \/ /
|   | || | | (_| | | | \__ \ |  _|  __/>  <
|   |_||_|  \__,_|_| |_|___/_|_|  \___/_/\_\
| 
| 
| Welcome to the Transifex Client! Please follow the instructions to
| initialize your project.
| 
| tx INFO: Creating config file...
| tx INFO: No credentials file was found at /root/.transifexrc.
| tx INFO: Created /root/.transifexrc 
| tx INFO: Updating /root/.transifexrc file...
| tx INFO: Using TX_TOKEN environment variable. Credentials won't be saved to .transifexrc.
| tx INFO: Done.
[Update translation files from Transifex/build]   ✅  Success - tx init --force --no-interactive --traceback
[Update translation files from Transifex/build] ⭐  Run tx pull -a --minimum-perc=1 --traceback --debug
[Update translation files from Transifex/build]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /home/brandon/Code/pih/openmrs-owa-orderentry/workflow/5] user=
| tx DEBUG: Path to tx is /home/brandon/Code/pih/openmrs-owa-orderentry.
| tx DEBUG: Config file is /home/brandon/Code/pih/openmrs-owa-orderentry/.tx/config
| tx DEBUG: .transifexrc file is at /root
| tx INFO: Done.
[Update translation files from Transifex/build]   ✅  Success - tx pull -a --minimum-perc=1 --traceback --debug

So tx pull is evidently not actually doing anything, but neither is it offering any information that could be used to debug, even with both --debug and --traceback provided. It's even exiting with status code 0. This leaves me at a total impasse.

brandones commented 3 years ago

The problem was that tx init was overwriting the already-existing .tx/config file. Of course, tx pull should give some kind of useful output about the configuration in this case.

For the edification of future generations, this is the working workflow configuration:

name: Update translation files from Transifex 

on:
  schedule:
    - cron: '36 0 * * *'
  workflow_dispatch:

jobs:
  build:

    runs-on: ubuntu-latest

    env:
      TX_TOKEN: ${{ secrets.TRANSIFEX_API_KEY }}

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
      - run: python -m pip install --upgrade pip
      - run: pip install transifex-client
      - run: tx pull -a --minimum-perc=1 --traceback
      - uses: EndBug/add-and-commit@v7
        with:
          add: app/js/translations
          message: 'Update translations'
RyanB99 commented 3 years ago

Hello,

Glad you figured it out. There is always room for improvement, so we will check out what you said.

However, we are also working on a new version of the TX client, which can be found here... https://github.com/transifex/cli. It is still considered an alpha version, but it is fairly stable, and it also uses the new version of the API (v3).

Let us know if you need anything else!

Regards, Ryan Transifex Support