forked from qgis/QGIS-Documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (68 loc) · 2.84 KB
/
pull_minimized_translations.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Pull translations
# Download partially translated files from Transifex
on:
schedule: #run at 23:00 on day-of-month 1 and 15
- cron: '0 23 1,15 * *'
workflow_dispatch:
permissions: # added using https://github.com/step-security/secure-repo
contents: read
jobs:
pull_translation:
permissions:
contents: write # for Git to git push
if: github.repository_owner == 'qgis'
runs-on: ubuntu-latest
strategy:
matrix:
# only pull to the translated branch
target_branch: [release_3.28]
env:
TRANSIFEX_PASSWORD: ${{ secrets.TRANSIFEX_PASSWORD }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@03bee3930647ebbf994244c21ddbc0d4933aab4f # v2.3.0
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Check out repository
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 1
ref: ${{ matrix.target_branch }}
- name: Install Transifex client
run: |
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
mv tx LICENSE -t /usr/local/bin/
- shell: bash
name: create .transifexrc file
run: |
sudo echo -e "[https://www.transifex.com]\nrest_hostname = https://rest.api.transifex.com\ntoken = $TRANSIFEX_PASSWORD" > ~/.transifexrc
- name: Download and sanitize files and folders
run: bash ./scripts/minimize_translation.sh
# - name: Show changes
# run: echo `git status`
- name: Load translations if any
run: |
git config --global user.name 'Transifex update'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
if git add locale/* && git commit -m "Loading new translations"; then
git push
else
echo "no new translations"
fi
# - name: Pull source file using transifex client
# uses: transifex/cli-action@bc67c0ab1369ef941f0963d902c45d11688c8bc9 # v1
# with:
# token: ${{ secrets.TRANSIFEX_PASSWORD }}
# args: pull --force --mode onlytranslated -l fr
# - name: Commit the changes in the PO files
# id: "auto-commit-action"
# uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a # v4.16.0
# with:
# commit_message: 'Load translated strings'
# - name: "Inform that changes have been made"
# if: steps.auto-commit-action.outputs.changes_detected == 'true'
# run: echo "Changes committed!"
# - name: "Inform that no changes were performed"
# if: steps.auto-commit-action.outputs.changes_detected == 'false'
# run: echo "No Changes detected!"