Simplifying GitHub Actions Workflows Through Typescript

Simplifying GitHub Actions Workflows Through Typescript

Unveiling github-actions-workflow-ts: An npm package that compiles Typescript into GitHub Actions YAML files

Quick Summary

Harness the power of Typescript for designing your GitHub Actions Workflows. Check out github-actions-workflow-ts

The Challenge with YAML

Despite its widespread use in DevOps and CI/CD pipelines—think Kubernetes, Jenkins, CircleCI, Bitbucket Pipelines, CloudFormation, and of course, GitHub Actions—YAML comes with its own set of complexities. Issues often arise from poor indentation, block referencing, and the tedious nature of code reuse.

Why Not YAML for GitHub Actions?

While YAML is somewhat versatile, it's not the most readable or maintainable choice for composing GitHub Actions Workflows. Attempting to implement complex functionality can make your YAML files convoluted, making the process of maintaining, updating or even remembering their function painful.

The Epiphany

Enter my introduction to AWS CDK a few years ago — a tool that lets you write infrastructure code in your preferred language and then compiles it into Cloudformation YAML. This sparked an idea: why not apply the same principle to GitHub Actions Workflows?

The Inspiration

Initially, I stumbled upon webiny/github-actions-wac, an incredible package that did exactly what I was envisioning. While it's a remarkable tool, I encountered some limitations concerning type exports, file naming, and directory placement. These led me down a path of extensive modifications and enhancements.

Introducing github-actions-workflow-ts

Instead of merely tweaking the existing package, I found myself reimagining many of its core functionalities. Thus, I introduce github-actions-workflow-ts — a package heavily inspired by the original but with expanded capabilities. While it's still in its beta stage (version 0.X.X), I'm close to releasing a stable 1.0.0 version. However, the current API is robust and already implemented in several of my projects.

Get Started Now

Curious to see it in action? Explore these Replit examples:


About the Author

I'm Emmanuel, passionate about software, AWS, and DevOps. If you found this article valuable, feel free to connect with me on LinkedIn or follow me on Twitter.