forked from opencast/opencast
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (54 loc) · 1.7 KB
/
update-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
name: Update translations
# Update every Monday at 5am
on:
workflow_dispatch:
schedule:
- cron: "0 5 * * 1"
jobs:
update-translations:
if: github.repository_owner == 'opencast'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: prepare git
run: |
git config --global user.email '[email protected]'
git config --global user.name 'Crowdin Bot'
- name: prepare crowdin client
run: |
wget --quiet https://artifacts.crowdin.com/repo/deb/crowdin3.deb
sudo dpkg -i crowdin3.deb
- name: prepare github ssh key
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
install -dm 700 ~/.ssh/
echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: clone repository
run: |
git clone "[email protected]:opencast/opencast.git" ~/oc
- name: update translations
env:
CROWDIN_TOKEN: ${{ secrets.CROWDIN_TOKEN }}
run: |
set -o errexit
update() {
git checkout "$1"
crowdin download --config .crowdin.yaml -b "$2"
git clean -f
if git commit -a -m "Automatically update translation keys ($1)"; then
git push origin "$1"
fi
git clean -fdx
}
if [ -z "${CROWDIN_TOKEN}" ]; then
echo Skipping update without secret
else
cd ~/oc
update develop develop
for branch in $(git for-each-ref --count=3 --sort=-committerdate refs/remotes/origin/r/ --format='%(refname:short)'); do
update "${branch##origin/}" "${branch##*/}"
done
fi