Skip to content

[CI] Adapt fetch-translations to use a PR #1598

@rfc2822

Description

@rfc2822

Something like

#!/bin/sh

# flags
CREATE_PR=-1

while getopts "hnp" opt; do
  case "$opt" in
    h)
      echo "$0 -n/-p"
      echo "-n Does not create a PR with gh CLI after fetching the translations"
      echo "-p Creates a PR with gh CLI after fetching the translations"
      exit 0
      ;;
    n)
      CREATE_PR=0
      ;;
    p)
      CREATE_PR=1
      ;;
  esac
done

if [ $CREATE_PR -eq -1 ]; then
  echo "Use -n or -p. See $0 -h for more information."
  exit 0
fi

cd `pwd $0`/..

# Prepare git branch "translations"
git fetch origin
git branch -f translations origin/main-ose
#git checkout translations 

# Fetch translations
export TX_TOKEN=`awk '/token *=/ { print $3; }' <$HOME/.transifexrc`
#tx pull -a -f --use-git-timestamps
if find app/src -type d -name 'values-*_*' -exec false '{}' +
then
  echo "No values-XX_RR directory found, good"
else
  echo "Found values-XX_RR directory, update .tx/config mappings to values-XX-rRR!"
  exit 1
fi

# Fetch translators
curl -H "Authorization: Bearer $TX_TOKEN" 'https://rest.api.transifex.com/team_memberships?filter\[organization\]=o:bitfireAT&filter\[team\]=o:bitfireAT:t:davx5-team' \
  | scripts/rewrite-translators.rb >app/src/main/assets/translators.json

git commit -m "Fetch translations from Transifex"

# Create PR if requested
if [ $CREATE_PR -eq 1 ]; then
  gh pr create --repo bitfireAT/davx5-ose --fill --web
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions