Skip to content

Commit

Permalink
Fail build on dependency-graph submit failure
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Jan 12, 2024
1 parent 4d69318 commit 3bb8c3d
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/integ-test-dependency-graph.yml
Original file line number Diff line number Diff line change
@@ -169,6 +169,7 @@ jobs:
insufficient-permissions:
runs-on: ubuntu-latest
continue-on-failure: true
permissions:
contents: read
steps:
10 changes: 3 additions & 7 deletions src/dependency-graph.ts
Original file line number Diff line number Diff line change
@@ -75,11 +75,7 @@ async function uploadDependencyGraphs(dependencyGraphFiles: string[]): Promise<v
}

async function downloadAndSubmitDependencyGraphs(): Promise<void> {
try {
await submitDependencyGraphs(await downloadDependencyGraphs())
} catch (e) {
core.warning(`Download and submit dependency graph failed. Will continue. ${String(e)}`)
}
await submitDependencyGraphs(await downloadDependencyGraphs())
}

async function submitDependencyGraphs(dependencyGraphFiles: string[]): Promise<void> {
@@ -88,15 +84,15 @@ async function submitDependencyGraphs(dependencyGraphFiles: string[]): Promise<v
await submitDependencyGraphFile(jsonFile)
} catch (error) {
if (error instanceof RequestError) {
core.warning(buildWarningMessage(jsonFile, error))
throw new Error(buildErrorMessage(jsonFile, error))
} else {
throw error
}
}
}
}

function buildWarningMessage(jsonFile: string, error: RequestError): string {
function buildErrorMessage(jsonFile: string, error: RequestError): string {
const relativeJsonFile = getRelativePathFromWorkspace(jsonFile)
const mainWarning = `Failed to submit dependency graph ${relativeJsonFile}.\n${String(error)}`
if (error.message === 'Resource not accessible by integration') {

0 comments on commit 3bb8c3d

Please sign in to comment.