From 6dd785b5dd6e8785406cee543c16f51a4c7c9d1f Mon Sep 17 00:00:00 2001 From: Henit Chobisa Date: Wed, 28 Feb 2024 15:50:28 +0530 Subject: [PATCH] chore: added parameters `TARGET_REPO_A` & `TARGET_REPO_B` for sync branch workflow (#3816) --- .github/workflows/create-sync-pr.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create-sync-pr.yml b/.github/workflows/create-sync-pr.yml index 47a85f3ba..5e64434bf 100644 --- a/.github/workflows/create-sync-pr.yml +++ b/.github/workflows/create-sync-pr.yml @@ -5,7 +5,7 @@ on: push: branches: - preview - + env: SOURCE_BRANCH_NAME: ${{ github.ref_name }} @@ -21,7 +21,7 @@ jobs: with: persist-credentials: false fetch-depth: 0 - + - name: Setup GH CLI run: | type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) @@ -31,14 +31,26 @@ jobs: sudo apt update sudo apt install gh -y - - name: Push Changes to Target Repo + - name: Push Changes to Target Repo A env: GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} run: | - TARGET_REPO="${{ secrets.SYNC_TARGET_REPO_NAME }}" + TARGET_REPO="${{ secrets.TARGET_REPO_A }}" TARGET_BRANCH="${{ secrets.SYNC_TARGET_BRANCH_NAME }}" SOURCE_BRANCH="${{ env.SOURCE_BRANCH_NAME }}" git checkout $SOURCE_BRANCH - git remote add target-origin "https://$GH_TOKEN@github.com/$TARGET_REPO.git" - git push target-origin $SOURCE_BRANCH:$TARGET_BRANCH + git remote add target-origin-a "https://$GH_TOKEN@github.com/$TARGET_REPO.git" + git push target-origin-a $SOURCE_BRANCH:$TARGET_BRANCH + + - name: Push Changes to Target Repo B + env: + GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} + run: | + TARGET_REPO="${{ secrets.TARGET_REPO_B }}" + TARGET_BRANCH="${{ secrets.SYNC_TARGET_BRANCH_NAME }}" + SOURCE_BRANCH="${{ env.SOURCE_BRANCH_NAME }}" + + git remote add target-origin-b "https://$GH_TOKEN@github.com/$TARGET_REPO.git" + git push target-origin-b $SOURCE_BRANCH:$TARGET_BRANCH +