From PolyRepo to MonoRepo architecture using Github CI/CD
Managing MonoRepo having its own positives and negatives. But most of the products are moving towards MonoRepo architecture.

I am having some example to maintain a MonoRepo from MultiRepo architecture.

For this experiment we can have two individual repositories (repo1, repo2). The objective is to push these two codes to mono_repo
when commit new changes.
Private Access Token
Create Private Access Token (PAT) in your github https://github.com/settings/tokens to give the access to commit the code programmatically. And select all repo
access and give the name as PAT_TOKEN

Add workflow.yaml
on both repo1 and repo2
on: pushjobs:
replicate-file:
runs-on: ubuntu-latest
name: Replicate Filesteps:
- name: Checkout current repo
uses: actions/checkout@v2
with:
path: ./repo- name: Checkout MonoRepo
uses: actions/checkout@master
with:
repository: muthugit/mono_repo
token: ${{ secrets.PAT_TOKEN }}
path: ./mono_repo- name: Copy/Create file
run: |
cp ./repo/README.md ./mono_repo/repo1.md
- name: Push to mono_repo
run: |
cd ./mono_repo
git add .
git config user.name github-actions
git config user.email github-actions@github.com
git commit -am "File Replicated from Project A"
git push
Copy the same YAML in repo2
When you commit code on either repo1 or repo2 the latest code will be available on the mono_repo
Conclusion
This way we can manage MonoRepo for a project where multiple dependencies are there