Skip to content

Commit 4b85e13

Browse files
authored
Merge pull request #916 from exoego/release-note-detection
Do not include non-existent release note/changelog
2 parents ce645ea + e3f6297 commit 4b85e13

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

modules/core/src/main/scala/org/scalasteward/core/util/HttpExistenceClient.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package org.scalasteward.core.util
1919
import cats.implicits._
2020
import io.chrisdavenport.log4cats.Logger
2121
import org.http4s.client.Client
22-
import org.http4s.{Method, Request, Uri}
22+
import org.http4s.{Method, Request, Status, Uri}
2323

2424
final class HttpExistenceClient[F[_]](
2525
implicit
@@ -31,7 +31,7 @@ final class HttpExistenceClient[F[_]](
3131

3232
def exists(uri: Uri): F[Boolean] = {
3333
val req = Request[F](method = Method.HEAD, uri = uri)
34-
client.status(req).map(_.isSuccess).handleErrorWith { throwable =>
34+
client.status(req).map(_ === Status.Ok).handleErrorWith { throwable =>
3535
logger.debug(throwable)(s"Failed to check if $uri exists").as(false)
3636
}
3737
}

modules/core/src/test/scala/org/scalasteward/core/vcs/VCSExtraAlgTest.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class VCSExtraAlgTest extends FunSuite with Matchers {
1414
val routes: HttpRoutes[IO] =
1515
HttpRoutes.of[IO] {
1616
case HEAD -> Root / "foo" / "bar" / "compare" / "v0.1.0...v0.2.0" => Ok("exist")
17+
case HEAD -> Root / "foo" / "buz" / "compare" / "v0.1.0...v0.2.0" => PermanentRedirect()
1718
case _ => NotFound()
1819
}
1920

@@ -23,6 +24,7 @@ class VCSExtraAlgTest extends FunSuite with Matchers {
2324
val vcsExtraAlg = VCSExtraAlg.create[IO]
2425
val updateFoo = Update.Single("com.example", "foo", "0.1.0", Nel.of("0.2.0"))
2526
val updateBar = Update.Single("com.example", "bar", "0.1.0", Nel.of("0.2.0"))
27+
val updateBuz = Update.Single("com.example", "buz", "0.1.0", Nel.of("0.2.0"))
2628

2729
test("getBranchCompareUrl") {
2830
vcsExtraAlg.getBranchCompareUrl(None, updateBar).unsafeRunSync() shouldBe None
@@ -32,5 +34,8 @@ class VCSExtraAlgTest extends FunSuite with Matchers {
3234
vcsExtraAlg
3335
.getBranchCompareUrl(Some("https://github.com/foo/bar"), updateBar)
3436
.unsafeRunSync() shouldBe Some("https://github.com/foo/bar/compare/v0.1.0...v0.2.0")
37+
vcsExtraAlg
38+
.getBranchCompareUrl(Some("https://github.com/foo/buz"), updateBuz)
39+
.unsafeRunSync() shouldBe None
3540
}
3641
}

0 commit comments

Comments
 (0)