Best practices for storing / organising shell scripts for workflow steps?

In many of the job steps in my workflow definitions, I use short shell invocations. They’ve been mostly “in-line” within the YAML, but I’ve reached the stage where I think it would be better to have them in their own (.sh) files, for two reasons:

  • I can test them independently and individually
  • I can benefit from my editor’s shell syntax highlighting and linting

Has anyone come to the same conclusion, and what’s more, come up with any best practices as to where in the repo to store them? In the .github/workflows/ directory directly? In another .hidden/ directory in the repo?

All thoughts welcome. Thanks!

It’s a matter of taste, I suppose. Personally I’d use a non-hidden directory with a name that makes the purpose clear, e.g. ci-scripts/ or something like that.

I have seen people use their own subdirectories of .github/, but I’d be wary of that because files in there can have special meaning for GitHub tools. Even if there’s no conflict now, what if they add a new feature and suddenly there is? :wink: