ProjectPythia / cookbook-gallery

Root site for the ProjectPythiaCookbooks GitHub Pages
https://cookbooks.projectpythia.org
MIT License
2 stars 13 forks source link

Automation for Cookbook repos #86

Open brian-rose opened 2 years ago

brian-rose commented 2 years ago

We frequently have a need to push identical (or very similar) changes out simultaneously to all Cookbook source repos. One example is changing the URL for the binder link in the _config.yml in each repo as discussed in #85

Currently we have no better option than manually edit and opening identical PRs in each repo.

Two possible alternatives for keeping the infrastructure updated across all repos:

  1. Some kind of bot service (like dependabot) that can automatically open PRs across all repos (e.g. when we make a change in the template repo). This still requires people to inspect and approve the PRs for each repo, but would speed things up and help ensure consistency while still allowing individual Cookbook authors to customize their own infrastructure as necessary
  2. Migrating more of the Cookbook infrastructure out of individual repos and into some centralized repository. For example, instead of hard-coding the Binder URL in each repo's _config.yml, there could be a lookup step. This would mean only opening a single PR to change any of the centralized infrastructure across all Cookbooks.
clyne commented 1 year ago

Labeling this medium priority for now, but this will become high priority as gallery grows.

brian-rose commented 1 year ago

Parallel discussion happening in this discourse post

@ahuang11 suggested actions-template-sync as a possible solution. Looks promising!

brian-rose commented 1 year ago

Noting here that I experimented a bit with actions-template-sync in a few different repos (see e.g. this workflow in the XGCM Cookbook and this example PR generated by the workflow).

My conclusion for now is that this is not the right tool for us.

The basic reason is that there are too many merge conflicts between an individual cookbook repo and the template repo -- like any line of code in the template where a generic line like

title: Project Pythia Cookbook Template

is replaced with a more meaningful line.

actions-template-sync by default uses a merge strategy that favors the template in any merge conflict situation.

The result (as can be seen in this example) is a PR that tries to replace a lot of useful content in the cookbook with generic boilerplate from the template -- not what we want!

I played around with different git merge strategy flags but wasn't able to get anything working that applies an intelligent auto-merge-conflict resolution.

brian-rose commented 1 year ago

Of course it is possible to use actions-template-sync to auto-generate a PR, and then manually push changes to that PR before merging. But that seems like more trouble than it's worth.