1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

ci: fix trezor-common sync gh worfklow

This commit is contained in:
vdovhanych 2024-09-06 09:24:04 +02:00 committed by matejcik
parent b9a104d2ac
commit aa47f951ec
2 changed files with 16 additions and 15 deletions

View File

@ -12,9 +12,9 @@ jobs:
sync-common:
runs-on: ubuntu-latest
env:
GITHUB_BOT_USERNAME: ${{ secrets.TREZOR_BOT_USERNAME }}
GITHUB_BOT_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
GITHUB_BOT_EMAIL: ${{ secrets.TREZOR_BOT_EMAIL }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN_COMMON_FINE }}
BOT_USERNAME: ${{ secrets.TREZOR_BOT_USERNAME }}
BOT_EMAIL: ${{ secrets.TREZOR_BOT_EMAIL }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
@ -23,20 +23,21 @@ jobs:
- name: Copy git-filter and script to temporary directory
run: |
cp ./ci/common_sync/git-filter-repo/git-filter-repo ${{runner.temp}}/common_repo_sync.sh
cp ./ci/common_sync/git-filter-repo/git-filter-repo ${{runner.temp}}/git-filter-repo
cp ./ci/common_sync/common_repo_sync.sh ${{runner.temp}}/common_repo_sync.sh
cp ./ci/common_sync/git-filter-repo ${{runner.temp}}/git-filter-repo
- name: Confiugre git user
run: |
git config --global user.name "${BOT_USERNAME}"
git config --global user.email "${BOT_EMAIL}"
- name: Add git-filter-repo to PATH
run: |
echo "Adding git-filter-repo to PATH"
echo '${{ runner.temp }}/ci/common_sync/git-filter-repo' >> $GITHUB_PATH
- name: Configure git user
run: |
git config --global user.name $GITHUB_BOT_USERNAME
git config --global user.email $GITHUB_BOT_EMAIL
echo '${{runner.temp}}' >> $GITHUB_PATH
- name: Sync trezor-common repository
run: |
echo "Synchronizing common with the trezor-common repository"
.${{ runner.temp }}/common_repo_sync.sh
git config --unset-all http.https://github.com/.extraheader
${{ runner.temp }}/common_repo_sync.sh

View File

@ -1,13 +1,13 @@
#!/usr/bin/env bash
GH_USER="$GITHUB_BOT_USERNAME"
GH_TOKEN="$GITHUB_BOT_TOKEN"
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://$GH_USER:$GH_TOKEN@github.com/trezor/trezor-common.git 2>/dev/null
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