Skip to content

Commit

Permalink
Add sync weblate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
racicLuka committed Apr 24, 2024
1 parent b5f0b59 commit 8da9214
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 18 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/github-actions-demo.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/sync-weblate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Sync Weblate Commits

on:
push:
branches:
- main

jobs:
check-and-sync:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: List Weblate Commits
id: weblate-commits
run: |
git fetch origin
COMMITS=$(git log --format=%H --grep="^Weblate" origin/main..)
echo "::set-output name=commits::$COMMITS"
- name: Check for Commits in Other Branches
id: check-other-branches
run: |
OTHER_BRANCHES=$(git branch --format='%(refname:short)' | grep -v "main")
for BRANCH in $OTHER_BRANCHES; do
for COMMIT in ${{ steps.weblate-commits.outputs.commits }}; do
if git branch --contains $COMMIT | grep -q $BRANCH; then
echo "Commit $COMMIT exists in branch $BRANCH"
exit 1
fi
done
done
- name: Pull Weblate Commits to Other Branches
if: ${{ failure() }}
run: |
for BRANCH in $OTHER_BRANCHES; do
for COMMIT in ${{ steps.weblate-commits.outputs.commits }}; do
git checkout $BRANCH
git cherry-pick $COMMIT
done
done
git push origin $OTHER_BRANCHES

0 comments on commit 8da9214

Please sign in to comment.