Skip to content

Commit 6ae5695

Browse files
authored
Merge pull request #3221 from scala-steward-org/topic/artifact-migrations-label
Add label for artifact migrations
2 parents 01a549d + 02ff89d commit 6ae5695

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,18 @@ object NewPullRequestData {
314314
val semverLabels =
315315
update.on(u => semverForUpdate(u), _.updates.flatMap(semverForUpdate(_)).distinct)
316316

317+
val artifactMigrationsLabel = Option.when {
318+
update.asSingleUpdates
319+
.flatMap(_.forArtifactIds.toList)
320+
.exists(u => u.newerGroupId.nonEmpty || u.newerArtifactId.nonEmpty)
321+
}("artifact-migrations")
317322
val scalafixLabel = edits.collectFirst { case _: ScalafixEdit => "scalafix-migrations" }
318323
val oldVersionLabel = Option.when(filesWithOldVersion.nonEmpty)("old-version-remains")
319324

320325
List.concat(
321326
updateTypeLabels(update),
322327
semverLabels,
328+
artifactMigrationsLabel,
323329
scalafixLabel,
324330
oldVersionLabel,
325331
List(commitCountLabel)

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class NewPullRequestDataTest extends FunSuite {
131131
assertEquals(body, expected)
132132
}
133133

134-
test("bodyFor() groupped update") {
134+
test("bodyFor() grouped update") {
135135
val update1 = ("ch.qos.logback".g % "logback-classic".a % "1.2.0" %> "1.2.3").single
136136
val update2 = ("com.example".g % "foo".a % "1.0.0" %> "2.0.0").single
137137
val update = Update.Grouped("my-group", Some("The PR title"), List(update1, update2))
@@ -515,6 +515,13 @@ class NewPullRequestDataTest extends FunSuite {
515515
assertEquals(labels, expected)
516516
}
517517

518+
test("artifact-migrations label") {
519+
val update = ("a".g % "b".a % "1" -> "2").single.copy(newerGroupId = Some("aa".g))
520+
val obtained = labelsFor(update)
521+
val expected = List("library-update", "artifact-migrations", "commit-count:0")
522+
assertEquals(obtained, expected)
523+
}
524+
518525
test("oldVersionNote doesn't show version for grouped updates") {
519526
val files = List("Readme.md", "travis.yml")
520527
val update1 = ("a".g % "b".a % "1" -> "2").single
@@ -539,7 +546,7 @@ class NewPullRequestDataTest extends FunSuite {
539546
)
540547
}
541548

542-
test("adjustFutureUpdates for grouped udpates shows settings for each update") {
549+
test("adjustFutureUpdates for grouped updates shows settings for each update") {
543550
val update1 = ("a".g % "b".a % "1" -> "2").single
544551
val update2 = ("c".g % "d".a % "1.1.0" % "test" %> "1.2.0").single
545552
val update = Update.Grouped("my-group", None, List(update1, update2))

0 commit comments

Comments
 (0)