Skip to main content
Version: 2.x

ZIO SBT GitHub Actions

zio-sbt-githubactions is a Scala model of GitHub Actions workflows and of the config files of dependency bots. ZIO SBT CI uses it to render the generated YAML, and a build uses it to describe jobs, steps and triggers in build.sbt. The module is published as a dependency of zio-sbt-ci, so it needs no installation of its own. Its types live in the zio.sbt.githubactions package and are not exported through autoImport, so import them explicitly.

Workflow Modelโ€‹

A Workflow holds a name, environment variables, triggers, jobs and an optional Concurrency. A Job holds steps and the settings of one GitHub Actions job. The following types make up the model.

TypeDescription
WorkflowName, env, triggers, jobs, concurrency and permissions. withoutPermissions omits the permissions block, which is not the same as an empty map
Jobid, name, runsOn, continueOnError, strategy, steps, need, services, condition, jobTimeout, concurrency and permissions
StrategyStrategy(matrix, maxParallel = None, failFast = true), the matrix of a job
StepStep.SingleStep has name, id, uses, condition, parameters, run and env. Step.StepSequence groups several steps
ActionRefThe uses reference of a step, such as actions/checkout@v7.0.1
TriggerWorkflowDispatch, Schedule, Release, PullRequest, PullRequestTarget, Push, Create, WorkflowRun and IssueComment
BranchBranch.All or Branch.Named(name), used by push and pull request triggers
ConditionCondition.Expression(expression) renders as ${{ expression }}. Condition.Function(expression) renders as written. Both combine with && and ||, but a Function cannot be combined
ServiceA service container: name, image, env, ports and options
ImageRefThe image of a service, such as ImageRef("postgres:16")
ServicePortServicePort(inner, outer) renders as inner:outer
ConcurrencyConcurrency(group, cancelInProgress = CancelInProgress.Always)
CancelInProgressAlways, Never or When(condition)
OSThe runner operating system. OS.UbuntuLatest renders as ubuntu-latest

To change a job that a setting produced, copy it with the Job methods withStrategy, withRunsOn, withSteps, withServices, withTimeout and withPermissions. A job's timeoutMinutes field is deprecated in favor of jobTimeout.

The zio.sbt.V object resolves the pinned version of an action, so V("actions/checkout") returns the actions/checkout@<version> reference that the generated workflows use.

CI Setting Typesโ€‹

These types are the values of the ci* settings of ZIO SBT CI.

TypeUsed byDescription
DependencyBotciDependencyUpdateBotsDependabot (dependabot[bot]), Renovate (renovate[bot]), ScalaSteward(githubAppName) (<githubAppName>[bot]) and Custom(login)
DeployPreviewModeciDeployPreviewModeAutomatic or OnDemand
DependabotConfigciDependabotConfigDependabotConfig(updates), by default one weekly github-actions update
DependabotUpdateDependabotConfigecosystem, directory = "/", interval = "weekly", openPullRequestsLimit, groups and excludePaths
DependabotGroupDependabotUpdatename, patterns and updateTypes
ScalaStewardConfigciScalaStewardConfigThe .scala-steward.conf content: pins, allow, ignore, updatesLimit, updatePullRequests, commitMessage, pullRequestsFrequency, grouping, assignees and reviewers
ScalaStewardDependencyScalaStewardConfiggroupId, artifactId and version
ScalaStewardGroupingRuleScalaStewardConfigname and a filter of ScalaStewardGroupFilter(group, version)
ReleaseDrafterCategoryciReleaseDrafterCategoriestitle and the labels that put a pull request in the category
ReleaseDrafterVersionResolverciReleaseDrafterVersionResolverThe labels for major, minor and patch, and the default bump
ReleaseDrafterAutolabelerRuleciReleaseDrafterAutolabelerA label and the files, branch, title and body patterns that apply it

The how-to guides show these types at work. See Auto-Approve and Auto-Merge Dependency Update PRs, Configure Dependabot Updates and Customize the Generated CI Jobs.

ZIO Chat

๐ŸŒŸ Greetings from ZIO Chat! ๐ŸŒŸ Have questions about ZIO? Look no further! I'm here to be your ZIO guru. Whether you're a seasoned pro or just starting out, I've got answers tailored just for you. Fire away with your ZIO queries, and I'll hit you back with the best insights I've got. Let's dive into the world of ZIO together!