Skip to content

Update translations #130

Update translations

Update translations #130

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