Hi, I'm using github-workflows-kt to generate gith...
# github-workflows-kt
l
Hi, I'm using github-workflows-kt to generate github actions yaml files, but I don't use kotlin scripting part at all. I have my own "little system" to update yaml (and other source) files in maintained repos. After updating to github-workflows-kt 2.0.0 I don't see any way to get generated yaml content. I guess I would need at least
Workflow.writeToFile
to be public again, and public
Workflow.generateYaml
or sth similar would also be nice.
p
Hi Marek, what advantages do you see of writing the YAML in a custom way?
l
I just have it as a part of bigger "workflow" with streamlined updating different kinds of source files. So I don't want to be forced to update my yamls in "custom" way. By "custom" I mean your way ;)
p
Is any repo that uses this way open-source? It would be nice to see a concrete example. What kind of operations you need to do between defining the workflow with the DSL and writing it to YAML? Is there some YAML postprocessing involved? I generally simplified the API to have one way of creating the YAML, so I'd be interested in learning what kind of customization one may need. Maybe we could fit it into the
workflow() {}
function?
Or maybe you're building your workflows not as a single invocation of the DSL but in parts? Just guessing, the example would be appreciated
l
It's open source but very hacky/experimental so let's not look there 🙂 Generally between is interaction with user who approves changes manually but fast.
For me it would be great if
workflow
DSL default behavior was as you see fit, but with possibility to skip auto write and to get yaml content from returned
Workflow
manually.
Or maybe If you don't want to complicate fun
workflow
, it would be enough for me to be able to construct
Workflow
data class object manually and then somehow generate yaml content using it. Or maybe it's already possible?
Or maybe comment above doesn't make any sense - I only just started diving into source code. 🙂
p
Ok, I'll think about it, now I'm in a pre-flight rush so hard to get into a proper discussion and propose a change :D thanks for the feedback anyway, will get back to you here!
l
Great, thanks!
p
Ok, here's an idea how to get the behavior you want, what changes we'd have to make to the lib: • https://github.com/typesafegithub/github-workflows-kt/blob/667ff90edef13d825f7a86c5cfdca2288690f917/github-workflows-kt/src/main/kotlin/io/github/typesafegithub/workflows/dsl/WorkflowBuilder.kt#L174 - set targetFileName to null, then writing to file would be disabled • https://github.com/typesafegithub/github-workflows-kt/blob/667ff90edef13d825f7a86c5cfdca2288690f917/github-workflows-kt/src/main/kotlin/io/github/typesafegithub/workflows/yaml/ToYaml.kt#L90 - make generateYaml public, to call it on the Workflow domain object Let me know if it would fit your needs
The nullable targetFileName is something I forgot to make non-null for 2.0.0, but it saves the day considering we want to support your use case :)
l
Yes, that
s exactly what I need.
p
Ok, could you please create a simple ticket that summarizes it (im on the go right now), so that I don't forget to include it in the next release?
👍 1
@langara - feat(dsl): allow writing workflow to string is merged, I'm going to release within a week, alternatively you can try out with the snapshots
thank you color 1