How to mirror a GitHub repo using Github actions?

Viewed 1595

I would like to know if there is a way to use GitHub Actions to automatically mirror changes from repoA to repoB.

Both would be private repositories.
The workflow would be like this: a commit would be pushed to a branch on repoA and then automatically the same commit would be sent to repoB as well.

I've seen posts on adding a remote repository, but would be interested to see how GitHub Actions can help to improve this.

1 Answers

You might consider a GitHub Action like Git Sync:

A GitHub Action for syncing between two independent repositories using force push.

You add use in it an SSH private key to access to your second repository

ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

(since you can create and store encrypted secrets in a workflow)

Related