Save dependency-graph file as workflow artifact

Diagnosing unexpected dependencies in the GitHub Dependency Graph can
be difficult. In order to aid with diagnosis, the `dependency-submission`
action will  now save each dependency-graph file as a workflow artifact.

If this is undesirable, the prior behaviour can be restored by explicitly setting
`dependency-graph: generate-and-submit`.

Fixes #519
This commit is contained in:
daz
2025-01-21 11:41:58 -07:00
committed by Daz DeBoer
parent 28ab4dff3a
commit 245c8a24de
7 changed files with 84 additions and 23 deletions

View File

@@ -60,7 +60,10 @@ export async function complete(config: DependencyGraphConfig): Promise<void> {
case DependencyGraphOption.DownloadAndSubmit: // Performed in setup
return
case DependencyGraphOption.GenerateAndSubmit:
await findAndSubmitDependencyGraphs(config)
await findAndSubmitDependencyGraphs(config, false)
return
case DependencyGraphOption.GenerateSubmitAndUpload:
await findAndSubmitDependencyGraphs(config, true)
return
case DependencyGraphOption.GenerateAndUpload:
await findAndUploadDependencyGraphs(config)
@@ -83,7 +86,7 @@ async function downloadAndSubmitDependencyGraphs(config: DependencyGraphConfig):
}
}
async function findAndSubmitDependencyGraphs(config: DependencyGraphConfig): Promise<void> {
async function findAndSubmitDependencyGraphs(config: DependencyGraphConfig, uploadAfterSubmit: boolean): Promise<void> {
if (isRunningInActEnvironment()) {
core.info('Dependency graph not supported in the ACT environment.')
return
@@ -100,6 +103,10 @@ async function findAndSubmitDependencyGraphs(config: DependencyGraphConfig): Pro
}
throw e
}
if (uploadAfterSubmit) {
await uploadDependencyGraphs(dependencyGraphFiles, config)
}
}
async function findAndUploadDependencyGraphs(config: DependencyGraphConfig): Promise<void> {