Pull translations from transifex #832
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull translations from transifex | |
on: | |
schedule: | |
- cron: "0 */12 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
pull_translations: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Max fetch depth (full history of files) | |
- name: Install transifex client | |
run: | | |
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash | |
- name: Pull translations | |
env: | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
run: | | |
./tx pull --all --use-git-timestamps | |
- name: Get list of changed files | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "CHANGED<<$EOF" >> "$GITHUB_ENV" | |
git status --porcelain | head -10 >> "$GITHUB_ENV" | |
echo "$EOF" >> "$GITHUB_ENV" | |
- name: Push changes to the repository | |
uses: EndBug/[email protected] | |
with: | |
author_name: github-actions[bot] | |
author_email: 41898282+github-actions[bot]@users.noreply.github.com | |
message: | | |
Pull translations from transifex | |
Changed files (at most 10): | |
${{ env.CHANGED }} | |
# trigger-translation-artifacts-autobuild: | |
# runs-on: ubuntu-latest | |
# needs: pull_translations | |
# steps: | |
# - name: Repository Dispatch | |
# uses: peter-evans/repository-dispatch@v2 | |
# with: | |
# token: ${{ secrets.PAT }} | |
# repository: dfint/autobuild | |
# event-type: update | |
update_metadata: | |
runs-on: ubuntu-latest | |
needs: pull_translations | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.* | |
cache: "poetry" | |
cache-dependency-path: automation/poetry.lock | |
- name: Install library and dependencies | |
run: | | |
cd automation | |
poetry install --no-interaction --no-dev | |
- name: Generate metadata files | |
run: | | |
cd automation | |
poetry run files_by_resource ../translations ../ | |
- name: Pull changes | |
run: git pull | |
- name: Push changes to the repository | |
uses: EndBug/[email protected] | |
with: | |
author_name: github-actions[bot] | |
author_email: 41898282+github-actions[bot]@users.noreply.github.com | |
add: metadata*.json | |
message: Update metadata |