Skip to content

Sync from main to locale branches #4

Sync from main to locale branches

Sync from main to locale branches #4

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
name: Sync from main to locale branches
on:
workflow_dispatch:
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- run: sudo apt-get install -y git-filter-repo
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: git config
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- run: |
for lc in $(git diff-tree --no-commit-id --name-only last-sync main); do
git tag base-$lc last-sync;
git branch next-$lc main;
git filter-repo --subdirectory-filter $lc --force --refs next-$lc base-$lc;
git checkout --track origin/$lc;
git cherry-pick base-$lc..next-$lc;
done
shell: bash
- run: git push origin $(git diff-tree --no-commit-id --name-only last-sync main | tr '\n' ' ')
shell: bash
- run: git tag --force last-sync main
- run: git push --force origin last-sync