How to get full `script`s as seen by the runner?

I’m working on a ShellCheck runner for GitLab CI code. The basic functionality is simple, but dealing with includes, YAML anchors, etc would require re-implementing a significant portion of the official parser. So where can I find the code which actually generates the full script which actually ends up running in GitLab CI?

Is it this helper script? It seems too simple, and doesn’t seem to deal with includes.