Typecheck, template and modularize your GitHub Actions definitions with Dhall
let GA =
https://raw.githubusercontent.com/shoukoo/dhall-github-actions/v0.0.4/package.dhall
in GA.Workflow::{
, name = "Test actions"
, on = GA.On::{ push = Some GA.OnPush::{ branches = Some [ "test" ] } }
, jobs = toMap
{ build = GA.Jobs::{
, name = Some "test actions"
, runs-on = [ "self-hosted" ]
, steps =
[ GA.Resource.Step GA.Step::{=}
, GA.Resource.ActionsCache
GA.actions/cache::{
, id = Some "action-cache"
, `with` = GA.actions/cache/with::{
, path = "file.lock"
, key = "file_lock"
}
}
, GA.Resource.ActionsCheckout GA.actions/checkout::{=}
, GA.Resource.ActionsGitHubScript
GA.actions/github-script::{
, `with` = GA.actions/github-script/with::{
, script =
''
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 Thanks for reporting!'
})
''
}
}
, GA.Resource.ActionsSetupGo
GA.actions/setup-go::{
, `with` = Some GA.actions/setup-go/with::{
, go-version = Some "100"
}
}
]
}
}
}
Please be sure to run dhall format
against your change before creating a PR
- The action must come from a verified GitHub account e.g. AWS, Hashicorp..etc. This is to ensure they're safe to consume.
- New action must inherits steps.dhall record type, this way it can get all the optional fields. Here is an example:
let Step = ./steps.dhall
let With = ./action.actions.github-script.with.dhall
in { Type = Step.Type ⩓ { `with` : With.Type }
, default = Step.default ⫽ { uses = Some "actions/github-script@v3" }
}
- New action file must follow this naming convention:
actions.<account name>.<action name>
. - Add your new action in both
api/stepUnion.dhall
andapi/package.dhall