Skip to content

Commit

Permalink
big test now
Browse files Browse the repository at this point in the history
  • Loading branch information
racicLuka committed Apr 24, 2024
1 parent 8bf8c23 commit efebc8e
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions .github/workflows/sync-weblate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,50 @@ jobs:
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
COMMITS=$(git log --grep="Weblate" main --format=%H)
echo "these are the commits $COMMITS"
BR=$(git branch -a)
echo "there are the branches $BR"
COMMITS=$(git log --grep="Weblate" origin/main --format=%H)
echo "{commits}=$COMMITS" >> $GITHUB_OUTPUT
- name: Set Other Branches
id: set-other-branches
run: |
cd weblate-test
git fetch --prune --tags
OTHER_BRANCHES=$(git branch -r | grep -v "origin/main" | cut -d'/' -f2 | xargs)
echo "these are the other branches $OTHER_BRANCHES"
echo "{other_branches}=$OTHER_BRANCHES" >> $GITHUB_OUTPUT
- name: Check for Commits in Other Branches
id: check-other-branches
run: |
cd weblate-test
MISSING_COMMITS=()
MISSING_BRANCHES=()
for BRANCH in ${{ steps.set-other-branches.outputs.other_branches }}; do
for COMMIT in ${{ steps.weblate-commits.outputs.commits }}; do
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
echo "{missing_commits}=$MISSING_COMMITS[*]" >> $GITHUB_OUTPUT
echo "{missing_branches}=$MISSING_BRANCHES[*]" >> $GITHUB_OUTPUT
- name: Pull Weblate Commits to Other Branches
run: |
cd weblate-test
MISSING_COMMITS=(${{ steps.check-other-branches.outputs.missing_commits }})
MISSING_BRANCHES=(${{ steps.check-other-branches.outputs.missing_branches }})
echo "these are the missing commits $MISSING_COMMITS"
for ((i=0; i<=${#MISSING_COMMITS[@]}; ++i)); do
git checkout ${MISSING_BRANCHES[$i]}
git cherry-pick ${MISSING_COMMITS[$i]}
done
git push origin $OTHER_BRANCHES

0 comments on commit efebc8e

Please sign in to comment.