Skip to content

Commit 58c9598

Browse files
authored
Merge pull request #2536 from exoego/new-message
Give advise to slow down update frequency
2 parents e3c2ae3 + 96c1a85 commit 58c9598

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

modules/core/src/main/scala/org/scalasteward/core/repoconfig/GroupRepoConfig.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package org.scalasteward.core.repoconfig
1919
import io.circe.Codec
2020
import io.circe.generic.extras.Configuration
2121
import io.circe.generic.semiauto.deriveCodec
22+
import org.scalasteward.core.data.Update
2223

2324
final case class GroupRepoConfig(
2425
pullRequests: PullRequestsConfig = PullRequestsConfig(),
@@ -32,4 +33,17 @@ object GroupRepoConfig {
3233
implicit val groupPullConfigCodec: Codec[GroupRepoConfig] =
3334
deriveCodec
3435

36+
def configToSlowDownUpdatesFrequency(update: Update): String =
37+
update match {
38+
case s: Update.Single =>
39+
s"""dependencyOverrides = [{
40+
| pullRequest = { frequency = "@monthly" },
41+
| dependency = { groupId = "${s.groupId}", artifactId = "${s.artifactId.name}" }
42+
|}]""".stripMargin
43+
case g: Update.Group =>
44+
s"""dependencyOverrides = [{
45+
| pullRequest = { frequency = "@monthly" },
46+
| dependency = { groupId = "${g.groupId}" }
47+
|}]""".stripMargin
48+
}
3549
}

modules/core/src/main/scala/org/scalasteward/core/vcs/data/NewPullRequestData.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import org.scalasteward.core.edit.EditAttempt
2525
import org.scalasteward.core.edit.EditAttempt.ScalafixEdit
2626
import org.scalasteward.core.git
2727
import org.scalasteward.core.git.Branch
28-
import org.scalasteward.core.repoconfig.RepoConfigAlg
28+
import org.scalasteward.core.repoconfig.{GroupRepoConfig, RepoConfigAlg}
2929
import org.scalasteward.core.util.{Details, Nel}
3030

3131
final case class NewPullRequestData(
@@ -55,7 +55,7 @@ object NewPullRequestData {
5555
val details = List(
5656
appliedMigrations,
5757
oldVersionDetails,
58-
ignoreFutureUpdates(update).some,
58+
adjustFutureUpdates(update).some,
5959
configParsingError.map(configParsingErrorDetails)
6060
).flatten
6161

@@ -130,13 +130,17 @@ object NewPullRequestData {
130130
)
131131
}
132132

133-
def ignoreFutureUpdates(update: Update): Details =
133+
def adjustFutureUpdates(update: Update): Details =
134134
Details(
135-
"Ignore future updates",
135+
"Adjust future updates",
136136
s"""|Add this to your `${RepoConfigAlg.repoConfigBasename}` file to ignore future updates of this dependency:
137137
|```
138138
|${RepoConfigAlg.configToIgnoreFurtherUpdates(update)}
139139
|```
140+
|Or, add this to slow down future updates of this dependency:
141+
|```
142+
|${GroupRepoConfig.configToSlowDownUpdatesFrequency(update)}
143+
|```
140144
|""".stripMargin.trim
141145
)
142146

modules/core/src/test/scala/org/scalasteward/core/vcs/data/NewPullRequestDataTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class NewPullRequestDataTest extends FunSuite {
2828
val expected =
2929
raw"""|{
3030
| "title" : "Update logback-classic to 1.2.3",
31-
| "body" : "Updates ch.qos.logback:logback-classic from 1.2.0 to 1.2.3.\n\n\nI'll automatically update this PR to resolve conflicts as long as you don't change it yourself.\n\nIf you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.\n\nConfigure Scala Steward for your repository with a [`.scala-steward.conf`](https://github.com/scala-steward-org/scala-steward/blob/${org.scalasteward.core.BuildInfo.gitHeadCommit}/docs/repo-specific-configuration.md) file.\n\nHave a fantastic day writing Scala!\n\n<details>\n<summary>Ignore future updates</summary>\n\nAdd this to your `.scala-steward.conf` file to ignore future updates of this dependency:\n```\nupdates.ignore = [ { groupId = \"ch.qos.logback\", artifactId = \"logback-classic\" } ]\n```\n</details>\n\nlabels: library-update, early-semver-patch, semver-spec-patch, commit-count:0",
31+
| "body" : "Updates ch.qos.logback:logback-classic from 1.2.0 to 1.2.3.\n\n\nI'll automatically update this PR to resolve conflicts as long as you don't change it yourself.\n\nIf you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.\n\nConfigure Scala Steward for your repository with a [`.scala-steward.conf`](https://github.com/scala-steward-org/scala-steward/blob/${org.scalasteward.core.BuildInfo.gitHeadCommit}/docs/repo-specific-configuration.md) file.\n\nHave a fantastic day writing Scala!\n\n<details>\n<summary>Adjust future updates</summary>\n\nAdd this to your `.scala-steward.conf` file to ignore future updates of this dependency:\n```\nupdates.ignore = [ { groupId = \"ch.qos.logback\", artifactId = \"logback-classic\" } ]\n```\nOr, add this to slow down future updates of this dependency:\n```\ndependencyOverrides = [{\n pullRequest = { frequency = \"@monthly\" },\n dependency = { groupId = \"ch.qos.logback\", artifactId = \"logback-classic\" }\n}]\n```\n</details>\n\nlabels: library-update, early-semver-patch, semver-spec-patch, commit-count:0",
3232
| "head" : "scala-steward:update/logback-classic-1.2.3",
3333
| "base" : "master",
3434
| "draft" : false
@@ -53,7 +53,7 @@ class NewPullRequestDataTest extends FunSuite {
5353
val expected =
5454
raw"""|{
5555
| "title" : "Update logback-classic to 1.2.3",
56-
| "body" : "Updates ch.qos.logback:logback-classic from 1.2.0 to 1.2.3.\n\n\nI'll automatically update this PR to resolve conflicts as long as you don't change it yourself.\n\nIf you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.\n\nConfigure Scala Steward for your repository with a [`.scala-steward.conf`](https://github.com/scala-steward-org/scala-steward/blob/${org.scalasteward.core.BuildInfo.gitHeadCommit}/docs/repo-specific-configuration.md) file.\n\nHave a fantastic day writing Scala!\n\n<details>\n<summary>Ignore future updates</summary>\n\nAdd this to your `.scala-steward.conf` file to ignore future updates of this dependency:\n```\nupdates.ignore = [ { groupId = \"ch.qos.logback\", artifactId = \"logback-classic\" } ]\n```\n</details>\n<details>\n<summary>Note that the Scala Steward config file `.scala-steward.conf` wasn't parsed correctly</summary>\n\n```\nFailed to parse .scala-steward.conf\n```\n</details>\n\nlabels: library-update, early-semver-patch, semver-spec-patch, commit-count:0",
56+
| "body" : "Updates ch.qos.logback:logback-classic from 1.2.0 to 1.2.3.\n\n\nI'll automatically update this PR to resolve conflicts as long as you don't change it yourself.\n\nIf you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.\n\nConfigure Scala Steward for your repository with a [`.scala-steward.conf`](https://github.com/scala-steward-org/scala-steward/blob/${org.scalasteward.core.BuildInfo.gitHeadCommit}/docs/repo-specific-configuration.md) file.\n\nHave a fantastic day writing Scala!\n\n<details>\n<summary>Adjust future updates</summary>\n\nAdd this to your `.scala-steward.conf` file to ignore future updates of this dependency:\n```\nupdates.ignore = [ { groupId = \"ch.qos.logback\", artifactId = \"logback-classic\" } ]\n```\nOr, add this to slow down future updates of this dependency:\n```\ndependencyOverrides = [{\n pullRequest = { frequency = \"@monthly\" },\n dependency = { groupId = \"ch.qos.logback\", artifactId = \"logback-classic\" }\n}]\n```\n</details>\n<details>\n<summary>Note that the Scala Steward config file `.scala-steward.conf` wasn't parsed correctly</summary>\n\n```\nFailed to parse .scala-steward.conf\n```\n</details>\n\nlabels: library-update, early-semver-patch, semver-spec-patch, commit-count:0",
5757
| "head" : "scala-steward:update/logback-classic-1.2.3",
5858
| "base" : "master",
5959
| "draft" : false

0 commit comments

Comments
 (0)