Github Actions Templates

We are using Github actions for our several workflows. These WF are being setup using templates defined in a separate repository. I need to understand if there is any way that the changes to templates can be propagated to individual workflows.
As of now once a WF is setup using a template, any changes to the template itself are not reflected in the WF created and needs recreating the WF again using the template.

Let me know if anymore details required.

Thanks

Try reusable workflows Reusing workflows - GitHub Docs

1 Like

You could try to cherry-pick / rebase the changes or something similar, but, in general if you’re talking about:

https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template

Each repository created from a template repository gets 1 or more squashed branches. Because they’re squashed (and squashed at the time of creation), their commit SHAs will not match the commit SHAs for any other repository created from the template as well as the template repository itself.

There are a couple of hacks I’ve used to deal w/ this.

merge common point

  • force pull the template repository into a local clone of the templated repository
  • merge the common point together
  • rebase the newer template commits onto the merge commit – you may be able to skip this step, but I like it because it’s easier to reason through
  • rebase the newer commits from the merge commit onto the repository tip
  • push the new commits to the templated repository
  • optionally discard the merge commit to disconnect (and possibly garbage collect) the template commits

Use Quilt

  • You could make a clone of the template repository, use quilt to import commits leading back to the templated repository’s branch point
  • then move the quilt metadata into the templated repository
  • use git quiltimport to apply them

Note: I haven’t used quilt. I heavily used an equivalent tool for a different DVCS a long time ago.