How to automate repo sync between customer managed git repo (we are using git hub) and Cloud manager repo. | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by daniel-strmecki

Hello,

you can achieve this by only using Git commands. However, for automation, I recommend using GitHub Actions.

Here is an example workflow to Push a Selected Branch to Adobe Git:

 

name: Git Sync To Adobe Repo on: workflow_dispatch: push: branches: - develop jobs: build: name: Push Selected Branch to Adobe Git runs-on: ubuntu-latest steps: - name: Checkout Git Source Code run: | git clone --branch "$GITHUB_REF_NAME" https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/$GITHUB_REPOSITORY - name: Push Branch to Adobe Repository run: | cd ${{github.event.repository.name}} git remote add adobe https://${{secrets.ADOBE_GIT_USER}}:${{secrets.ADOBE_GIT_TOKEN}}@git.cloudmanager.adobe.com/${{secrets.ADOBE_GIT_PATH}} git push adobe "$GITHUB_REF_NAME"

 

Make sure to add the required GitHub Actions secrets used in the example.

 

Hope this helps,

Daniel

4 replies

h_kataria
Community Advisor
Community Advisor
September 17, 2024
Saravanan_Dharmaraj
Community Advisor
Community Advisor
September 17, 2024
daniel-strmecki
Community Advisor and Adobe Champion
daniel-strmeckiCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
September 18, 2024

Hello,

you can achieve this by only using Git commands. However, for automation, I recommend using GitHub Actions.

Here is an example workflow to Push a Selected Branch to Adobe Git:

 

name: Git Sync To Adobe Repo on: workflow_dispatch: push: branches: - develop jobs: build: name: Push Selected Branch to Adobe Git runs-on: ubuntu-latest steps: - name: Checkout Git Source Code run: | git clone --branch "$GITHUB_REF_NAME" https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/$GITHUB_REPOSITORY - name: Push Branch to Adobe Repository run: | cd ${{github.event.repository.name}} git remote add adobe https://${{secrets.ADOBE_GIT_USER}}:${{secrets.ADOBE_GIT_TOKEN}}@git.cloudmanager.adobe.com/${{secrets.ADOBE_GIT_PATH}} git push adobe "$GITHUB_REF_NAME"

 

Make sure to add the required GitHub Actions secrets used in the example.

 

Hope this helps,

Daniel

Level 2
September 19, 2024

Hi  daniel-strmecki

 

As part of solution you have suggested few steps. Can you please suggest on this. what secrets should be used for  https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/$GITHUB_REPOSITORY
 https://${{secrets.ADOBE_GIT_USER}}:${{secrets.ADOBE_GIT_TOKEN}}@git.cloudmanager.adobe.com/${{secrets.ADOBE_GIT_PATH}}

 

secrets of any existing user works or we need to create a new user and use that secrets for this kind of implemntation.

 

Thankyou,

Bala

 

 

daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 19, 2024

Hi @kacharlaba,

you will need a user who has access to both the GitHub repo and the Adobe repo. You can use your personal account and generate an access token in GitHub/Cloud Manager. However, in that case, your username will appear in GitHub Actions and Git history. A slightly better option would be to create a service account user, assuming you have the time for it 🙂

 

Hope this helps,

Daniel