Skip to content

Translated using Weblate (German) #48

Translated using Weblate (German)

Translated using Weblate (German) #48

Workflow file for this run

name: Sync Weblate Commits
on:
push:
branches:
- main
jobs:
check-and-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout code
run: |
git clone https://github.com/racicLuka/weblate-test.git
cd weblate-test
git checkout main
- name: List Weblate Commits
id: weblate-commits
run: |
cd weblate-test
git fetch origin
output=$(git log --grep="Weblate" origin/main --format=%H)
declare -a COMMITS=()
while IFS= read -r line; do
COMMITS+=("$line")
done <<< "$output"
git fetch --prune --tags
branches_output=$(git branch -r | grep -v "origin/main" | cut -d'/' -f2 | xargs)
declare -a OTHER_BRANCHES=()
while IFS= read -r word; do
OTHER_BRANCHES+=("$word")
done <<< "$branches_output"
MISSING_COMMITS=()
MISSING_BRANCHES=()
for BRANCH in $OTHER_BRANCHES; do
echo "this is the branch $BRANCH"
for COMMIT in $COMMITS; do
echo "this is the commit $COMMIT"
if ! git branch --contains $COMMIT | grep -q "remotes/origin/$BRANCH"; then
echo "Commit $COMMIT does not exist in branch $BRANCH"
MISSING_COMMITS+=($COMMIT)
MISSING_BRANCHES+=($BRANCH)
fi
done
done
for ((i=0; i<=${#MISSING_COMMITS[@]}; ++i)); do
git checkout ${MISSING_BRANCHES[$i]}
git config --global user.email "[email protected]"
git config --global user.name "racicLuka"
git cherry-pick ${MISSING_COMMITS[$i]}
git push origin HEAD
done