File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
sbt-plugin/src/main/scala/ch/epfl/scala Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ inputs:
37
37
description : Version of the sbt plugin to use.
38
38
required : false
39
39
default : ' 2.1.2'
40
+ outputs :
41
+ submission-id :
42
+ description : The ID of the submission created by the action
43
+ submission-api-url :
44
+ description : The URL of the submission created by the action
40
45
runs :
41
46
using : ' node16'
42
47
main : ' dist/index.js'
Original file line number Diff line number Diff line change @@ -96,12 +96,23 @@ object SubmitDependencyGraph {
96
96
snapshot <- getSnapshot(httpResp)
97
97
} yield {
98
98
state.log.info(s " Submitted successfully as $snapshotUrl/ ${snapshot.id}" )
99
+ setGithubOutputs(
100
+ " submission-id" -> s " ${snapshot.id}" ,
101
+ " submission-api-url" -> s " ${snapshotUrl}/ ${snapshot.id}"
102
+ )
99
103
state
100
104
}
101
105
102
106
result.get
103
107
}
104
108
109
+ // https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
110
+ private def setGithubOutputs (outputs : (String , String )* ): Unit = IO .writeLines(
111
+ file(githubOutput),
112
+ outputs.toSeq.map { case (name, value) => s " ${name}= ${value}" },
113
+ append = true
114
+ )
115
+
105
116
private def getSnapshot (httpResp : FullResponse ): Try [SnapshotResponse ] =
106
117
httpResp.status match {
107
118
case status if status / 100 == 2 =>
@@ -168,6 +179,7 @@ object SubmitDependencyGraph {
168
179
private def githubApiUrl (): String = githubCIEnv(" GITHUB_API_URL" )
169
180
private def githubRepository (): String = githubCIEnv(" GITHUB_REPOSITORY" )
170
181
private def githubToken (): String = githubCIEnv(" GITHUB_TOKEN" )
182
+ private def githubOutput (): String = githubCIEnv(" GITHUB_OUTPUT" )
171
183
172
184
private def githubCIEnv (name : String ): String =
173
185
Properties .envOrNone(name).getOrElse {
You can’t perform that action at this time.
0 commit comments