You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* submitSnapshot submits a snapshot to the Dependency Submission API - vendored in from @github/dependency-submission-toolkit, to make it work at the CLI, vs in Actions.
193
193
*
194
-
* @param {Snapshot} snapshot
195
-
* @param {Repo} repo
194
+
* @param {Octokit} octokit - The Octokit instance for GitHub API requests
195
+
* @param {Snapshot} snapshot - The dependency snapshot to submit
196
+
* @param {Repo} repo - The repository owner and name
197
+
* @returns {Promise<boolean>} true if submission was successful, false otherwise
196
198
*/
197
199
exportasyncfunctionsubmitSnapshot(
198
200
octokit: Octokit,
199
201
snapshot: Snapshot,
200
202
repo: {owner: string;repo: string}
201
-
){
203
+
): Promise<boolean>{
202
204
console.debug('Submitting snapshot...')
203
205
console.debug(snapshot.prettyJSON())
204
206
@@ -220,10 +222,12 @@ export async function submitSnapshot(
220
222
`Snapshot successfully created at ${response.data.created_at.toString()}`+
221
223
` with id ${response.data.id}`
222
224
)
225
+
returntrue
223
226
}else{
224
227
console.error(
225
228
`Snapshot creation failed with result: "${result}: ${response.data.message}"`
226
229
)
230
+
returnfalse
227
231
}
228
232
}catch(error){
229
233
if(errorinstanceofRequestError){
@@ -240,6 +244,6 @@ export async function submitSnapshot(
240
244
console.error(error.message)
241
245
if(error.stack)console.error(error.stack)
242
246
}
243
-
thrownewError(`Failed to submit snapshot: ${error}`)
0 commit comments