servatrice/.github/workflows/translations-pull.yml
tooomm e9c502ab32
CI: Add action for pulling new translations (#4911)
* Update and rename translations.yml to translations-push.yml

* Rename update_translations.sh to update_translation_source_strings.sh

* Update and rename update_translations_template.md to update_translation_source_strings_template.md

* Add translations-pull.yml

* Update config

* Update desktop-lint.yml

* Update desktop-build.yml

* correct env var naming

* names
2023-10-15 18:47:15 -04:00

73 lines
2.5 KiB
YAML

name: Update Translations
on:
workflow_dispatch:
schedule:
# runs in the middle of each month starting a quarter (UTC) = two weeks after new strings are built
- cron: '0 0 15 1,4,7,10 *'
pull_request:
paths:
- '.github/workflows/translations-pull.yml'
jobs:
translations:
# Do not run the scheduled workflow on forks
if: github.event_name != 'schedule' || github.repository_owner == 'Cockatrice'
name: Pull languages
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Pull translated strings from Transifex
uses: transifex/cli-action@v2
with:
# used config file: https://github.com/Cockatrice/Cockatrice/blob/master/.tx/config
# https://github.com/transifex/cli#pulling-files-from-transifex
token: ${{ secrets.TX_TOKEN }}
args: pull --all
- name: Create pull request
if: github.event_name != 'pull_request'
id: create_pr
uses: peter-evans/create-pull-request@v5
with:
add-paths: |
cockatrice/translations/*.ts
oracle/translations/*.ts
webclient/public/locales/*/translation.json
commit-message: Update translation files
# author is the owner of the commit
author: github-actions <github-actions@github.com>
branch: ci-update_translations
delete-branch: true
title: '[Translations] Update translations'
body: |
`pull -all` strings from [Transifex][1]
<br>
---
*This PR is automatically generated and updated by the workflow at `.github/workflows/translations-pull.yml`.*<br>
*After merging, all new languages and translations are available in the next build.*
[1]: https://app.transifex.com/cockatrice/cockatrice/
labels: |
CI
Translation
draft: false
- name: PR Status
if: github.event_name != 'pull_request'
shell: bash
env:
STATUS: ${{ steps.create_pr.outputs.pull-request-operation }}
run: |
if [[ "$STATUS" == "" ]]; then
echo "PR #${{ steps.create_pr.outputs.pull-request-number }} unchanged!"
else
echo "PR #${{ steps.create_pr.outputs.pull-request-number }} $STATUS!"
fi
echo "URL: ${{ steps.create_pr.outputs.pull-request-url }}"