From aa47f951ec9947c784f27c358a6a0c9faceeeafc Mon Sep 17 00:00:00 2001 From: vdovhanych Date: Fri, 6 Sep 2024 09:24:04 +0200 Subject: [PATCH] ci: fix trezor-common sync gh worfklow --- .github/workflows/bot-common-sync.yml | 25 +++++++++++++------------ ci/common_sync/common_repo_sync.sh | 6 +++--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/bot-common-sync.yml b/.github/workflows/bot-common-sync.yml index 3197c7113..f6686a0e3 100644 --- a/.github/workflows/bot-common-sync.yml +++ b/.github/workflows/bot-common-sync.yml @@ -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: Add git-filter-repo to PATH + - name: Confiugre git user run: | - echo "Adding git-filter-repo to PATH" - echo '${{ runner.temp }}/ci/common_sync/git-filter-repo' >> $GITHUB_PATH + git config --global user.name "${BOT_USERNAME}" + git config --global user.email "${BOT_EMAIL}" - - name: Configure git user + - name: Add git-filter-repo to PATH run: | - git config --global user.name $GITHUB_BOT_USERNAME - git config --global user.email $GITHUB_BOT_EMAIL + echo "Adding git-filter-repo to PATH" + 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 diff --git a/ci/common_sync/common_repo_sync.sh b/ci/common_sync/common_repo_sync.sh index 6caae4f2e..e38328309 100755 --- a/ci/common_sync/common_repo_sync.sh +++ b/ci/common_sync/common_repo_sync.sh @@ -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