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.
191
191
*
192
-
* @param {Snapshot} snapshot
193
-
* @param {Repo} repo
192
+
* @param {Octokit} octokit - The Octokit instance for GitHub API requests
193
+
* @param {Snapshot} snapshot - The dependency snapshot to submit
194
+
* @param {Repo} repo - The repository owner and name
195
+
* @returns {Promise<boolean>} true if submission was successful, false otherwise
194
196
*/
195
197
exportasyncfunctionsubmitSnapshot(
196
198
octokit: Octokit,
197
199
snapshot: Snapshot,
198
200
repo: {owner: string;repo: string}
199
-
){
201
+
): Promise<boolean>{
200
202
console.debug('Submitting snapshot...')
201
203
console.debug(snapshot.prettyJSON())
202
204
@@ -218,10 +220,12 @@ export async function submitSnapshot(
218
220
`Snapshot successfully created at ${response.data.created_at.toString()}`+
219
221
` with id ${response.data.id}`
220
222
)
223
+
returntrue
221
224
}else{
222
225
console.error(
223
226
`Snapshot creation failed with result: "${result}: ${response.data.message}"`
224
227
)
228
+
returnfalse
225
229
}
226
230
}catch(error){
227
231
if(errorinstanceofRequestError){
@@ -238,6 +242,6 @@ export async function submitSnapshot(
238
242
console.error(error.message)
239
243
if(error.stack)console.error(error.stack)
240
244
}
241
-
thrownewError(`Failed to submit snapshot: ${error}`)
0 commit comments