Skip to content

Commit 04b2c80

Browse files
authored
clean: Avoid depending on two json libraries (#495)
1 parent 9cc735f commit 04b2c80

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

build.sbt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ name := "codacy-coverage-reporter"
1010
// Runtime dependencies
1111
libraryDependencies ++= Seq(
1212
"com.github.alexarchambault" %% "case-app" % "2.1.0-M26",
13-
"org.wvlet.airframe" %% "airframe-log" % "22.3.0",
14-
"com.lihaoyi" %% "ujson" % "1.5.0"
13+
"org.wvlet.airframe" %% "airframe-log" % "22.3.0"
1514
)
1615

1716
// Test dependencies

src/main/scala/com/codacy/rules/commituuid/providers/GitHubActionProvider.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import java.nio.file.Files
55

66
import com.codacy.model.configuration.CommitUUID
77
import com.codacy.rules.commituuid.CommitUUIDProvider
8+
import play.api.libs.json._
89
import wvlet.log.LazyLogger
910

1011
import scala.util.Try
@@ -53,12 +54,12 @@ object GitHubActionProvider extends CommitUUIDProvider with LazyLogger {
5354

5455
private def extractHeadSHA(eventName: String, eventContent: String) = {
5556
Try {
56-
val eventJson = ujson.read(eventContent)
57+
val eventJson = Json.parse(eventContent)
5758
eventName match {
5859
case "workflow_run" =>
59-
eventJson(eventName)("head_sha").str
60+
(eventJson \ eventName \ "head_sha").as[String]
6061
case _ =>
61-
eventJson(eventName)("head")("sha").str
62+
(eventJson \ eventName \ "head" \ "sha").as[String]
6263
}
6364
}.toEither.left.map(t => s"Unable to fetch SHA from event file. Failed with error: ${t.getMessage}")
6465
}

0 commit comments

Comments
 (0)