Skip to content

Commit 8bfaa67

Browse files
committed
feat: write JSON to temp file and expose its path
1 parent 0c1e45b commit 8bfaa67

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

sbt-plugin/src/main/scala/ch/epfl/scala/SubmitDependencyGraph.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ object SubmitDependencyGraph {
8282
val snapshotUrl = s"${githubApiUrl()}/repos/${githubRepository()}/dependency-graph/snapshots"
8383

8484
val snapshotJson = CompactPrinter(Converter.toJsonUnsafe(snapshot))
85+
86+
val snapshotJsonFile = IO.withTemporaryFile("dependency-snapshot-", ".json") { file =>
87+
IO.write(file, snapshotJson)
88+
state.log.info(s"Dependency snapshot written to ${file.getAbsolutePath}")
89+
file
90+
}
91+
8592
val request = Gigahorse
8693
.url(snapshotUrl)
8794
.post(snapshotJson, StandardCharsets.UTF_8)
@@ -98,7 +105,8 @@ object SubmitDependencyGraph {
98105
state.log.info(s"Submitted successfully as $snapshotUrl/${snapshot.id}")
99106
setGithubOutputs(
100107
"submission-id" -> s"${snapshot.id}",
101-
"submission-api-url" -> s"${snapshotUrl}/${snapshot.id}"
108+
"submission-api-url" -> s"${snapshotUrl}/${snapshot.id}",
109+
"snapshot-json-path" -> snapshotJsonFile.getAbsolutePath
102110
)
103111
state
104112
}

0 commit comments

Comments
 (0)