How to sync repository template changes?

Hiyo! I maintain a repository template to help me set up new repositories. When I make changes to the template, I would like to sync those changes out to all the repositories I’ve created from that template.

For example if I edit .github/workflows/main.yml in my template, I want to automatically create pull requests to bring those changes into each repository I’ve created from that template.

If there’s nothing built-in for this, I think it could be easy to do with GitHub Actions. The ways I’ve found to trigger such a workflow, though, would require running on a schedule or manually keeping a list of repositories I’ve created from the template.

How do you synchronize template changes out to repositories created from the template?

2 Likes

Hey @solvaholic, there is no way to auto-update the repo’s you have created from the template. In my opinion, the “on push” trigger makes the most sense as long as you push large changes to the repo at once. 

2 Likes

Did you manage to do what you asked for?

Hi @tetienne :wave: I did!

The first solution I tried was to initiate updates from the template repository itself. This required maintaining a list of repositories to sync to, and storing credentials that would let an Actions workflow push to those repositories. That was a lot to keep up with!

Now I include a sync-from-template scheduled workflow in my template repository. This way when I create a repository from the template it will automatically keep itself up-to-date. And I can delete or disable the workflow if don’t want it to run.