Skip to content

Commit

Permalink
clean: Avoid depending on two json libraries (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
lolgab authored Mar 25, 2024
1 parent 9cc735f commit 04b2c80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ name := "codacy-coverage-reporter"
// Runtime dependencies
libraryDependencies ++= Seq(
"com.github.alexarchambault" %% "case-app" % "2.1.0-M26",
"org.wvlet.airframe" %% "airframe-log" % "22.3.0",
"com.lihaoyi" %% "ujson" % "1.5.0"
"org.wvlet.airframe" %% "airframe-log" % "22.3.0"
)

// Test dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import java.nio.file.Files

import com.codacy.model.configuration.CommitUUID
import com.codacy.rules.commituuid.CommitUUIDProvider
import play.api.libs.json._
import wvlet.log.LazyLogger

import scala.util.Try
Expand Down Expand Up @@ -53,12 +54,12 @@ object GitHubActionProvider extends CommitUUIDProvider with LazyLogger {

private def extractHeadSHA(eventName: String, eventContent: String) = {
Try {
val eventJson = ujson.read(eventContent)
val eventJson = Json.parse(eventContent)
eventName match {
case "workflow_run" =>
eventJson(eventName)("head_sha").str
(eventJson \ eventName \ "head_sha").as[String]
case _ =>
eventJson(eventName)("head")("sha").str
(eventJson \ eventName \ "head" \ "sha").as[String]
}
}.toEither.left.map(t => s"Unable to fetch SHA from event file. Failed with error: ${t.getMessage}")
}
Expand Down

0 comments on commit 04b2c80

Please sign in to comment.