I've been using CUE for GHA definitions. I find it much more readable and writable. Dhall syntax is not for me and development has slowed while CUE's has picked up. Starlark is the other config language I see gaining some adoption.
Here is the same GHA in CUE
// top-level config
name: "Node.js CI"
on: {
pull_request: branches: ["main"]
push: branches: ["main"]
}
// jobs loop, unified with below
jobs: {
for _,ver in ["20", "21"] {
"buildNode\(ver)Job": #job & { _ver: ver }
}
}
// common job config
#job: {
_ver: string
"runs-on": "ubuntu-latest"
steps: [{
name: "Checkout"
uses: "actions/checkout@v2"
},{
name: "Use Node.js"
uses: "actions/setup-node@v2"
with: "node-version": _ver
},{
name: "Install Deps"
run: "npm install"
},{
name: "Run Build"
run: "npm run build"
}]
}
`cue export gha.cue -o gha.yaml`
There are many ways to make this more interesting. Imagine extending this to configure the OS or matrix builds. The most useful might be to import the GHA schema to ensure you are writing "correct" workflows before you ship them.
Here is the same GHA in CUE
`cue export gha.cue -o gha.yaml`There are many ways to make this more interesting. Imagine extending this to configure the OS or matrix builds. The most useful might be to import the GHA schema to ensure you are writing "correct" workflows before you ship them.