1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-15 10:58:09 +00:00
trezor-firmware/ci/common_sync/common_repo_sync.sh
2024-09-12 09:37:53 +02:00

26 lines
779 B
Bash
Executable File

#!/usr/bin/env bash
COMMON_REPO_TOKEN="$BOT_TOKEN"
COMMON_REPO_USER="$BOT_USERNAME"
# checkout to temporary branch
git checkout -B tmp
# setup trezor-common remote
git remote add sync-common https://$COMMON_REPO_USER:$COMMON_REPO_TOKEN@github.com/trezor/trezor-common.git 2>/dev/null
# top commit in HEAD before monorepo was introduced
TOP_COMMIT_IN_COMMON=893fd219d4a01bcffa0cd9cfa631856371ec5aa9
# convert contents of the repository so that common/ is the root
git filter-repo --refs $TOP_COMMIT_IN_COMMON..HEAD --subdirectory-filter=common/ --force
# filter out .gitrepo
git filter-repo --refs $TOP_COMMIT_IN_COMMON..HEAD --path .gitrepo --invert-paths
# push changes to trezor-common repository
git push sync-common tmp:master
# cleanup
git remote remove sync-common