Rather than encouraging users to pipe files it'd be easier to to have something like a Workflow.writeToFile(inputPath: Path, outputPath: Path)
API. This also allows users like me with a lot of workflows to be able to generate all of the outputs in one go without having to resort to too much shell scripting. Having at least the output path be a property in the workflow would also help simplify this. Ultimately I envision being able to do something like this in a CI workflow to automatically update YAML files without requiring a consistency check job in each individual workflow
#!/usr/bin/env kscript
@file:DependsOn("it.krzeminski:github-actions-kotlin-dsl:0.2.0")
//INCLUDE workflow1.kt
//INCLUDE workflow2.kt
//INCLUDE workflow3.kt
//INCLUDE workflow4.kt
arrayOf(workflow1, workflow2, workflow3, workflow4).forEach { workflow ->
workflow.writeToFile() // implicitly uses an output parameter provided in the workflow itself
}