How to create an automated build&commit process between two repositories


I have two remote repositories; let’s say repoA and repoB. repoA is a vuepress repository that receives frequent Markdown commits, and repoB is a repository that consists of static files. After changing something in Markdowns of repoA, I build this repository and commit the generated HTML files to corresponding directories in repoB.

My goal is to automate this process: whenever repoA receives a commit, it will be built, and generated files will be replaced with the ones in repoB.

One solution would be writing a script to build the local repoA, to copy the generated files to local repoB, and commit local repoB to remote repoB. However, this solution wouldn’t be ideal, since this would require manual intervention after each change in repoA.

Any help would be appreciated. Thanks!