Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label for artifact migrations #3221

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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