Skip to content

Commit

Permalink
(chore) Add GitHub Actions flows to automate Transifex and upgrade co…
Browse files Browse the repository at this point in the history
…nfig (#174)
  • Loading branch information
ibacher authored Jan 16, 2024
1 parent 7eef26a commit 23a5769
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 6 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/tx-pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
workflow_dispatch:
schedule:
# every day at 8:05 PM UTC
- cron: "0 20 5 * *"

name: "Scheduled Transifex Update"

jobs:
pull-translations-from-transifex:
name: pull-translations-from-transifex

runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/checkout@v4
- name: Push source file using transifex client
uses: transifex/cli-action@v2
with:
token: ${{ secrets.TRANSIFEX_TOKEN }}
args: pull
- name: Create PR if necessary
uses: peter-evans/create-pull-request@v5
with:
commit-message: "(chore) Update translations from Transifex"
title: "(chore) Update translations from Transifex"
body: "Automated updates of translations pulled from Transifex"
branch: "chore/update-transifex"
author: "OpenMRS Bot <[email protected]>"
token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/tx-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
workflow_dispatch:
push:
branches: [main]

name: "Update Transifex on Push"

jobs:
push-translations-to-transifex:
name: push-translations-to-transifex

runs-on: ubuntu-latest
permissions:
actions: read

steps:
- uses: actions/checkout@v4
- name: Push source file using transifex client
uses: transifex/cli-action@v2
with:
token: ${{ secrets.TRANSIFEX_TOKEN }}
15 changes: 9 additions & 6 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[main]
host = https://www.transifex.com

[openmrs-esm-home.esm-home-app]
file_filter = packages/esm-home-app/translations/<lang>.json
minimum_perc = 0
source_file = packages/esm-home-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
[o:openmrs:p:openmrs-esm-home:r:esm-home-app]
file_filter = packages/esm-home-app/translations/<lang>.json
source_file = packages/esm-home-app/translations/en.json
source_lang = en
type = KEYVALUEJSON
minimum_perc = 0
replace_edited_strings = false
keep_translations = false

0 comments on commit 23a5769

Please sign in to comment.