I just released github-actions-workflow-ts, an NPM package that allows you to write GitHub Actions workflows in Typescript rather than YAML. The package then generates GH Actions workflow YAML files from your Typescript code.
Why?
- Type safety
- Code re-usability: package and reuse common jobs and steps across different workflows.
- Imperative edge: Utilize control flow to control the generation of different kinds of workflows easily.
Essentially, I realized that as I write larger and more complicated GH Actions workflows in YAML, they become less readable and thus more prone to errors and harder to maintain/refactor.
You can try it out on Replit (free but requires an account to fork my examples and run them yourself). Fork it and run the build command in the shell:
- Simple Example: https://replit.com/@EmmanuelKyeyune/github-actions-workflow-...
- Advanced Example: https://replit.com/@EmmanuelKyeyune/github-actions-workflow-...
Read the accompanying blog post here: https://emmanuelnk.hashnode.dev/simplifying-github-actions-w...
Please check it out. I'm open to any feedback as I march towards the first stable 1.0.0 release.
Thanks