Auto-Approve and Auto-Merge Dependency Update PRs
Besides ci.yml, the ciGenerateGithubWorkflow task also generates two more workflow files: auto-approve.yml and auto-merge.yml. These workflows automatically approve, and squash-merge once CI is green, pull requests opened by dependency-update bots, such as Scala Steward, Dependabot, and Renovate.
Both workflows trigger on pull_request_target and also support workflow_dispatch, which backfills the approval/auto-merge on every currently open PR from the configured botsβhandy for recovering PRs that were opened before the workflow existed, or after a workflow bug is fixed.
The set of trusted bots is controlled by the ciDependencyUpdateBots setting, which takes a Seq[DependencyBot]:
import zio.sbt.githubactions.DependencyBot
ciDependencyUpdateBots := Seq(
DependencyBot.Dependabot,
DependencyBot.Renovate,
DependencyBot.ScalaSteward("zio-scala-steward"),
DependencyBot.Custom("some-other-bot[bot]")
)
DependencyBot.Dependabotβ matches logindependabot[bot]DependencyBot.Renovateβ matches loginrenovate[bot]DependencyBot.ScalaSteward(githubAppName)β matches login<githubAppName>[bot], wheregithubAppNameis the name of the GitHub App you registered for Scala StewardDependencyBot.Custom(login)β matches any exact GitHub login, for bots not covered by the predefined cases
The default value mirrors the bots used by the zio/zio repository, plus the zio-assistant[bot] GitHub App that opens the README-update PRs: Seq(DependencyBot.Dependabot, DependencyBot.Renovate, DependencyBot.ScalaSteward("zio-scala-steward"), DependencyBot.Custom("zio-assistant[bot]")). If your Scala Steward GitHub App has a different name, override the setting with the correct ScalaSteward app name.
Note:
When the PR's base branch requires status checks (through classic branch protection or a ruleset),
auto-merge.ymlenables GitHub's native auto-merge withgh pr merge --auto --squashand finishes at once; GitHub merges the PR when the required checks pass. On a branch without required status checks, where--autowould merge before CI finishes, it instead waits for every check on the PR (other than its own bot jobs) to finish and merges withgh pr merge --squashonly if none failed. A red check fails the job and leaves the PR open. Theworkflow_dispatchbackfill still usesgh pr merge --auto, which merges immediately on a branch with no required status checks, so configure branch protection with required checks before relying on it.
Note:
GITHUB_TOKENcan never be granted the "workflows" scope needed to auto-merge a bot PR that touches.github/workflows/**, soauto-merge.ymlmints a GitHub App token for that case instead, falling back toGITHUB_TOKENwhen no app is configured (which still auto-merges ordinary, non-workflow-touching PRs fine). This needs the sameAPP_ID/APP_PRIVATE_KEYsecrets asupdate-readme, and the ZIO Assistant app installation must additionally have the Workflows repository permission granted and accepted β without it, workflow-touching PRs still fail to auto-merge and need a manual merge.