@@ -42,7 +42,7 @@ object SubmitDependencyGraph {
42
42
private def inputParser (state : State ): Parser [DependencySnapshotInput ] =
43
43
Parsers .any.* .map { raw =>
44
44
val rawString = raw.mkString
45
- if (rawString.isEmpty) DependencySnapshotInput (None , Vector .empty, Vector .empty)
45
+ if (rawString.isEmpty) DependencySnapshotInput (None , Vector .empty, Vector .empty, Some ( " " ) )
46
46
else
47
47
JsonParser
48
48
.parseFromString(rawString)
@@ -82,7 +82,8 @@ object SubmitDependencyGraph {
82
82
}
83
83
84
84
private def generateInternal (state : State ): State = {
85
- val snapshot = githubDependencySnapshot(state)
85
+ val input = state.attributes(githubSnapshotInputKey)
86
+ val snapshot = githubDependencySnapshot(state, input.correlator.getOrElse(" " ))
86
87
val snapshotJson = CompactPrinter (Converter .toJsonUnsafe(snapshot))
87
88
val snapshotJsonFile = IO .withTemporaryFile(" dependency-snapshot-" , " .json" , keepFile = true ) { file =>
88
89
IO .write(file, snapshotJson)
@@ -103,7 +104,8 @@ object SubmitDependencyGraph {
103
104
)
104
105
)
105
106
val snapshotUrl = s " ${githubApiUrl()}/repos/ ${githubRepository()}/dependency-graph/snapshots "
106
- val job = githubJob()
107
+ val input = state.attributes(githubSnapshotInputKey)
108
+ val job = githubJob(input.correlator.getOrElse(" " ))
107
109
val request = Gigahorse
108
110
.url(snapshotUrl)
109
111
.post(snapshotJsonFile)
@@ -145,7 +147,7 @@ object SubmitDependencyGraph {
145
147
throw new MessageOnlyException (message)
146
148
}
147
149
148
- private def githubDependencySnapshot (state : State ): DependencySnapshot = {
150
+ private def githubDependencySnapshot (state : State , correlator : String ): DependencySnapshot = {
149
151
val detector = DetectorMetadata (
150
152
SbtGithubDependencySubmission .name,
151
153
SbtGithubDependencySubmission .homepage.map(_.toString).getOrElse(" " ),
@@ -155,7 +157,7 @@ object SubmitDependencyGraph {
155
157
val manifests = state.get(githubManifestsKey).get
156
158
DependencySnapshot (
157
159
0 ,
158
- githubJob(),
160
+ githubJob(correlator ),
159
161
githubSha(),
160
162
githubRef(),
161
163
detector,
@@ -165,8 +167,7 @@ object SubmitDependencyGraph {
165
167
)
166
168
}
167
169
168
- private def githubJob (): Job = {
169
- val correlator = s " ${githubWorkflow()}_ ${githubJobName()}_ ${githubAction()}"
170
+ private def githubJob (correlator : String ): Job = {
170
171
val id = githubRunId
171
172
val html_url =
172
173
for {
@@ -181,9 +182,6 @@ object SubmitDependencyGraph {
181
182
throw new MessageOnlyException (s " Missing environment variable $name. This task must run in a Github Action. " )
182
183
}
183
184
check(" GITHUB_WORKSPACE" )
184
- check(" GITHUB_WORKFLOW" )
185
- check(" GITHUB_JOB" )
186
- check(" GITHUB_ACTION" )
187
185
check(" GITHUB_RUN_ID" )
188
186
check(" GITHUB_SHA" )
189
187
check(" GITHUB_REF" )
@@ -194,9 +192,6 @@ object SubmitDependencyGraph {
194
192
}
195
193
196
194
private def githubWorkspace (): String = Properties .envOrElse(" GITHUB_WORKSPACE" , " " )
197
- private def githubWorkflow (): String = Properties .envOrElse(" GITHUB_WORKFLOW" , " " )
198
- private def githubJobName (): String = Properties .envOrElse(" GITHUB_JOB" , " " )
199
- private def githubAction (): String = Properties .envOrElse(" GITHUB_ACTION" , " " )
200
195
private def githubRunId (): String = Properties .envOrElse(" GITHUB_RUN_ID" , " " )
201
196
private def githubSha (): String = Properties .envOrElse(" GITHUB_SHA" , " " )
202
197
private def githubRef (): String = Properties .envOrElse(" GITHUB_REF" , " " )
0 commit comments