Skip to content

Commit

Permalink
Merge pull request #3221 from scala-steward-org/topic/artifact-migrat…
Browse files Browse the repository at this point in the history
…ions-label

Add label for artifact migrations
  • Loading branch information
fthomas authored Nov 27, 2023
2 parents 01a549d + 02ff89d commit 6ae5695
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,18 @@ object NewPullRequestData {
val semverLabels =
update.on(u => semverForUpdate(u), _.updates.flatMap(semverForUpdate(_)).distinct)

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

List.concat(
updateTypeLabels(update),
semverLabels,
artifactMigrationsLabel,
scalafixLabel,
oldVersionLabel,
List(commitCountLabel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class NewPullRequestDataTest extends FunSuite {
assertEquals(body, expected)
}

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

test("artifact-migrations label") {
val update = ("a".g % "b".a % "1" -> "2").single.copy(newerGroupId = Some("aa".g))
val obtained = labelsFor(update)
val expected = List("library-update", "artifact-migrations", "commit-count:0")
assertEquals(obtained, expected)
}

test("oldVersionNote doesn't show version for grouped updates") {
val files = List("Readme.md", "travis.yml")
val update1 = ("a".g % "b".a % "1" -> "2").single
Expand All @@ -539,7 +546,7 @@ class NewPullRequestDataTest extends FunSuite {
)
}

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

0 comments on commit 6ae5695

Please sign in to comment.