|
| 1 | +# Repository-specific configuration |
| 2 | + |
| 3 | +You can add a configuration file `.scala-steward.conf` to configure how Scala Steward updates your repository. |
| 4 | +The `.scala-steward.conf` configuration file can be located in the root of your repository, in `.github` directory or in `.config` directory (searched in this order). |
| 5 | +If a configuration file exists in more than one location, only the first found file is taken into account. |
| 6 | + |
| 7 | +```scala mdoc:passthrough |
| 8 | +import io.circe.refined._ |
| 9 | +import io.circe.syntax._ |
| 10 | +import org.scalasteward.core.repoconfig._ |
| 11 | + |
| 12 | +print("```properties") |
| 13 | +print(s""" |
| 14 | +# pullRequests.frequency allows to control how often or when Scala Steward |
| 15 | +# is allowed to create pull requests. |
| 16 | +# |
| 17 | +# Possible values: |
| 18 | +# @asap |
| 19 | +# PRs are created without delay. |
| 20 | +# |
| 21 | +# <timespan> |
| 22 | +# PRs are created only again after the given timespan since the last PR |
| 23 | +# has passed. Example values are "36 hours", "1 day", or "14 days". |
| 24 | + |
| 25 | +# <CRON expression> |
| 26 | +# PRs are created roughly according to the given CRON expression. |
| 27 | +# |
| 28 | +# CRON expressions consist of five fields: |
| 29 | +# minutes, hour of day, day of month, month, and day of week. |
| 30 | +# |
| 31 | +# See https://www.alonsodomin.me/cron4s/userguide/index.html#parsing for |
| 32 | +# more information about the CRON expressions that are supported. |
| 33 | +# |
| 34 | +# Note that the date parts of the CRON expression are matched exactly |
| 35 | +# while the time parts are only used to abide to the frequency of |
| 36 | +# the given expression. |
| 37 | +# |
| 38 | +# Default: ${PullRequestsConfig.defaultFrequency.asJson.noSpaces} |
| 39 | +# |
| 40 | +#pullRequests.frequency = "0 0 ? * 3" # every thursday on midnight |
| 41 | +pullRequests.frequency = "7 days" |
| 42 | + |
| 43 | +# pullRequests.grouping allows you to specify how Scala Steward should group |
| 44 | +# your updates in order to reduce the number of pull-requests. |
| 45 | +# |
| 46 | +# Updates will be placed in the first group with which they match, starting |
| 47 | +# from the first in the array. Those that do not match any group will follow |
| 48 | +# the default procedure (one PR per update). |
| 49 | +# |
| 50 | +# Each element in the array will have the following schema: |
| 51 | +# |
| 52 | +# - name (mandatory): the name of the group, will be used for things like naming the branch |
| 53 | +# - title (optional): if provided it will be used as the title for the PR |
| 54 | +# - filter (mandatory): a non-empty list containing the filters to use to know |
| 55 | +# if an update falls into this group. |
| 56 | +# |
| 57 | +# `filter` properties would have this format: |
| 58 | +# |
| 59 | +# { |
| 60 | +# version = "major" | "minor" | "patch" | "pre-release" | "build-metadata", |
| 61 | +# group = "{group}", |
| 62 | +# artifact = "{artifact}" |
| 63 | +# } |
| 64 | +# |
| 65 | +# For more information on the values for the `version` filter visit https://semver.org/ |
| 66 | +# |
| 67 | +# Every field in a `filter` is optional but at least one must be provided. |
| 68 | +# |
| 69 | +# For grouping every update together a filter like {group = "*"} can be # provided. |
| 70 | +# |
| 71 | +# To create a new PR for each unique combination of artifact-versions, include $${hash} in the name. |
| 72 | +# |
| 73 | +# Default: [] |
| 74 | +pullRequests.grouping = [ |
| 75 | + { name = "patches", "title" = "Patch updates", "filter" = [{"version" = "patch"}] }, |
| 76 | + { name = "minor_major", "title" = "Minor/major updates", "filter" = [{"version" = "minor"}, {"version" = "major"}] }, |
| 77 | + { name = "typelevel", "title" = "Typelevel updates", "filter" = [{"group" = "org.typelevel"}, {"group" = "org.http4s"}] }, |
| 78 | + { name = "my_libraries_$${hash}", "filter" = [{"artifact" = "my-library"}, {"artifact" = "my-other-library", "group" = "my-org"}] }, |
| 79 | + { name = "all", "title" = "Dependency updates", "filter" = [{"group" = "*"}] } |
| 80 | +] |
| 81 | + |
| 82 | +# pullRequests.includeMatchedLabels allows to control which autogenerated labels are added to PRs |
| 83 | +# This setting has no effect on custom labels (see below). |
| 84 | +# via a regex check each label is checked against. |
| 85 | +# Defaults to no regex (all labels are added) which is equivalent to ".*". |
| 86 | +pullRequests.includeMatchedLabels = "(.*semver.*)|(commit-count:n:.*)" |
| 87 | + |
| 88 | +# pullRequests.customLabels allows to add custom labels to PRs. |
| 89 | +# This is useful if you want to use the labels for automation (project board for example). |
| 90 | +# Defaults to no labels (no labels are added). |
| 91 | +pullRequests.customLabels = [ "dependencies", "scala" ] |
| 92 | + |
| 93 | +# Only these dependencies which match the given patterns are updated. |
| 94 | +# |
| 95 | +# Each pattern must have `groupId`, and may have `artifactId` and `version`. |
| 96 | +# Defaults to empty `[]` which mean Scala Steward will update all dependencies. |
| 97 | +updates.allow = [ { groupId = "com.example" } ] |
| 98 | + |
| 99 | +# The dependencies which match the given version pattern are updated. |
| 100 | +# Dependencies that are not listed will be updated. |
| 101 | +# |
| 102 | +# Each pattern must have `groupId`, `version` and optional `artifactId`. |
| 103 | +# Defaults to empty `[]` which mean Scala Steward will update all dependencies. |
| 104 | +# the following example will allow to update foo when version is 1.1.x |
| 105 | +updates.pin = [ { groupId = "com.example", artifactId="foo", version = "1.1." } ] |
| 106 | + |
| 107 | +# The dependencies which match the given pattern are NOT updated. |
| 108 | +# |
| 109 | +# Each pattern must have `groupId`, and may have `artifactId` and `version`. |
| 110 | +# Defaults to empty `[]` which mean Scala Steward will not ignore dependencies. |
| 111 | +updates.ignore = [ { groupId = "org.acme", artifactId="foo", version = "1.0" } ] |
| 112 | + |
| 113 | +# The dependencies which match the given patterns are allowed to be updated to pre-release from stable. |
| 114 | +# This also implies, that it will be allowed for snapshot versions to be updated to snapshots of different series. |
| 115 | +# |
| 116 | +# Each pattern must have `groupId`, and may have `artifactId` and `version`. |
| 117 | +# Defaults to empty `[]` which mean Scala Steward will ignore all stable to pre-release update options. |
| 118 | +updates.allowPreReleases = [ { groupId = "com.example", artifactId="foo" } ] |
| 119 | + |
| 120 | +# If set, Scala Steward will only create or update `n` PRs each time it runs (see `pullRequests.frequency` above). |
| 121 | +# Useful if running frequently and/or CI build are costly |
| 122 | +# Default: ${UpdatesConfig.defaultLimit.asJson.noSpaces} |
| 123 | +updates.limit = 5 |
| 124 | + |
| 125 | +# The extensions of files that should be updated. |
| 126 | +# Default: ${UpdatesConfig.defaultFileExtensions.toList.sorted.asJson.noSpaces} |
| 127 | +updates.fileExtensions = [".scala", ".sbt", ".sbt.shared", ".sc", ".yml", ".md", ".markdown", ".txt"] |
| 128 | + |
| 129 | +# If "on-conflicts", Scala Steward will update the PR it created to resolve conflicts as |
| 130 | +# long as you don't change it yourself. |
| 131 | +# If "always", Scala Steward will always update the PR it created as long as |
| 132 | +# you don't change it yourself. |
| 133 | +# If "never", Scala Steward will never update the PR |
| 134 | +# Default: ${PullRequestUpdateStrategy.default.asJson.noSpaces} |
| 135 | +updatePullRequests = "always" | "on-conflicts" | "never" |
| 136 | + |
| 137 | +# If set, Scala Steward will use this message template for the commit messages and PR titles. |
| 138 | +# Supported variables: $${artifactName}, $${currentVersion}, $${nextVersion} and $${default} |
| 139 | +# Default: ${CommitsConfig.defaultMessage.asJson.noSpaces} which is equivalent to "Update $${artifactName} to $${nextVersion}" |
| 140 | +commits.message = "Update $${artifactName} from $${currentVersion} to $${nextVersion}" |
| 141 | + |
| 142 | +# If true and when upgrading version in .scalafmt.conf, Scala Steward will perform scalafmt |
| 143 | +# and add a separate commit when format changed. So you don't need reformat manually and can merge PR. |
| 144 | +# If false, Scala Steward will not perform scalafmt, so your CI may abort when reformat needed. |
| 145 | +# Default: ${ScalafmtConfig.defaultRunAfterUpgrading.asJson.noSpaces} |
| 146 | +scalafmt.runAfterUpgrading = false |
| 147 | + |
| 148 | +# It is possible to have multiple scala projects in a single repository. In that case the folders containing the projects (build.sbt folders) |
| 149 | +# are specified using the buildRoots property. Note that the paths used there are relative and if the repo directory itself also contains a build.sbt the dot can be used to specify it. |
| 150 | +# Default: ${RepoConfig.defaultBuildRoots.asJson.noSpaces} |
| 151 | +buildRoots = [ ".", "subfolder/projectA" ] |
| 152 | + |
| 153 | +# Define commands that are executed after an update via a hook. |
| 154 | +# A groupId and/or artifactId can be defined to only execute after certain dependencies are updated. If neither is defined, the hook runs for every update. |
| 155 | +postUpdateHooks = [{ |
| 156 | + command = ["sbt", "protobufGenerate"], |
| 157 | + commitMessage = "Regenerated protobuf files", |
| 158 | + groupId = "com.github.sbt", |
| 159 | + artifactId = "sbt-protobuf" |
| 160 | +}] |
| 161 | + |
| 162 | +# You can override some config options for dependencies that matches the given pattern. |
| 163 | +# Currently, "pullRequests" can be overridden. |
| 164 | +# Each pattern must have `groupId`, and may have `artifactId` and `version`. |
| 165 | +# First-matched entry is used. |
| 166 | +# More-specific entry should be placed before less-specific entry. |
| 167 | +# |
| 168 | +# Default: empty `[]` |
| 169 | +dependencyOverrides = [ |
| 170 | + { |
| 171 | + dependency = { groupId = "com.example", artifactId = "foo", version = "2." }, |
| 172 | + pullRequests = { frequency = "1 day" }, |
| 173 | + }, |
| 174 | + { |
| 175 | + dependency = { groupId = "com.example", artifactId = "foo" }, |
| 176 | + pullRequests = { frequency = "30 day" }, |
| 177 | + }, |
| 178 | + { |
| 179 | + dependency = { groupId = "com.example" }, |
| 180 | + pullRequests = { frequency = "14 day" }, |
| 181 | + } |
| 182 | +] |
| 183 | + |
| 184 | +# Assign people from the list to the pull request or request a review. |
| 185 | +# Currently supported only for GitLab and GitHub. |
| 186 | +# GitLab users - free version of GitLab only supports one assignee and one reviewer, others will be ignored. |
| 187 | +# GitHub users - to request review from a team inside your organisation it should be specified |
| 188 | +# like "yourOrg/yourTeam" in `reviewers` config below. |
| 189 | +# Please note that only accounts with write access to the repository (Developer role for GitLab) are able |
| 190 | +# to add assignees or request reviews. Consequently, it won't work for public @scala-steward instance on GitHub. |
| 191 | +assignees = [ "username1", "username2" ] |
| 192 | +reviewers = [ "username1", "username2" ] |
| 193 | +""") |
| 194 | +println("```") |
| 195 | +``` |
| 196 | + |
| 197 | +The version information given in the patterns above can be in two formats: |
| 198 | +1. just a `version` field that is treated as a prefix of the version |
| 199 | +2. a structure consisting of any of the following fields: |
| 200 | + * `prefix`: is matched against the beginning of the version |
| 201 | + * `suffix`: is matched against the end of the version |
| 202 | + * `exact`: is matched against the whole version |
| 203 | + * `contains`: is matched against substrings in the version |
| 204 | + |
| 205 | +```properties |
| 206 | +version = "1.1." |
| 207 | +version = { prefix = "1.1." } |
| 208 | +version = { suffix = "jre8" } |
| 209 | +version = { prefix = "1.1.", suffix = "jre8" } |
| 210 | +version = { exact = "1.1.2.jre8" } |
| 211 | +version = { contains = "feature" } |
| 212 | +``` |
| 213 | + |
| 214 | +## Ignore lines |
| 215 | + |
| 216 | +Though `updates.ignores` offers granular configuration to exclude dependencies from update, Scala Steward also recognizes markers in file to ignore lines. |
| 217 | + |
| 218 | +Dependencies in lines between `// scala-steward:off` and `// scala-steward:on` are not updated. |
| 219 | + |
| 220 | +```scala |
| 221 | +libraryDependencies ++= Seq( |
| 222 | + // scala-steward:off |
| 223 | + "com.github.pathikrit" %% "better-files" % "3.8.0", |
| 224 | + "com.olegpy" %% "better-monadic-for" % "0.3.1", |
| 225 | + // scala-steward:on |
| 226 | + "org.typelevel" %% "cats-effect" % "1.3.1", // This and subsequent will get updated |
| 227 | + "org.typelevel" %% "cats-kernel-laws" % "1.6.1" |
| 228 | +) |
| 229 | +``` |
| 230 | + |
| 231 | +Also, the line ends with `// scala-steward:off` is not updated solely. |
| 232 | + |
| 233 | +```scala |
| 234 | +libraryDependencies ++= Seq( |
| 235 | + "com.typesafe.akka" %% "akka-actor" % "2.4.0", // scala-steward:off |
| 236 | + "com.typesafe.akka" %% "akka-testkit" % "2.5.0", // This and subsequent will get updated |
| 237 | +) |
| 238 | +``` |
0 commit comments