Can I create a script library to source from override-* steps?

Is there any way to factor out common content from an override step in snapcraft.yaml so I don’t have to keep repeating myself from snap to snap?

Actual rationale: I may have a number of local patches to apply in “override-pull”, and I want to define my own standard such that all those patches would exist in a top-level “patches” directory, and if that directory exists, a script will peruse that directory and will apply patches appropriately.

Is there any way to centralize scripts like that so they need not be duplicated in every snapcraft.yaml file?

As far as I know YAML doesn’t offer a way to include external file snippets. Snapcraft doesn’t have a specific mechanism for that, so If the patch application code is non-trivial maybe you could add the patch application script to the patches directory and run it to apply what’s needed?