Expand my Community achievements bar.

SOLVED

How to automate repo sync between customer managed git repo (we are using git hub) and Cloud manager repo.

Avatar

Level 1

How do I automate repository sync between customer managed git repo (we are using git hub) and AEM Cloud manager repo.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 9

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

View solution in original post

5 Replies

Avatar

Correct answer by
Level 9

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

Avatar

Level 1

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/${{secre...

 

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

 

 

Avatar

Level 9

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