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:
3737 description : Version of the sbt plugin to use.
3838 required : false
3939 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
4045runs :
4146 using : ' node16'
4247 main : ' dist/index.js'
Original file line number Diff line number Diff line change @@ -96,12 +96,23 @@ object SubmitDependencyGraph {
9696 snapshot <- getSnapshot(httpResp)
9797 } yield {
9898 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+ )
99103 state
100104 }
101105
102106 result.get
103107 }
104108
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+
105116 private def getSnapshot (httpResp : FullResponse ): Try [SnapshotResponse ] =
106117 httpResp.status match {
107118 case status if status / 100 == 2 =>
@@ -168,6 +179,7 @@ object SubmitDependencyGraph {
168179 private def githubApiUrl (): String = githubCIEnv(" GITHUB_API_URL" )
169180 private def githubRepository (): String = githubCIEnv(" GITHUB_REPOSITORY" )
170181 private def githubToken (): String = githubCIEnv(" GITHUB_TOKEN" )
182+ private def githubOutput (): String = githubCIEnv(" GITHUB_OUTPUT" )
171183
172184 private def githubCIEnv (name : String ): String =
173185 Properties .envOrNone(name).getOrElse {
You can’t perform that action at this time.
0 commit comments