mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-22 00:01:05 -05:00
Improve compat with dependency-review-action
When using 'download-and-submit' for dependency graphs, we now run the submission immediately instead of waiting until the post-action. This allows a single job to both submit the graph and run the dependency review action.
This commit is contained in:
parent
d1b726d8c1
commit
f92e7c3428
3 changed files with 12 additions and 8 deletions
|
@ -710,8 +710,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Retrieve dependency graph artifact and submit
|
- name: Retrieve dependency graph artifact and submit
|
||||||
uses: gradle/gradle-build-action@v2
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
dependency-graph: download-and-submit
|
dependency-graph: download-and-submit
|
||||||
```
|
```
|
||||||
|
|
||||||
## Gradle version compatibility
|
## Gradle version compatibility
|
||||||
|
|
|
@ -14,8 +14,13 @@ import {DependencyGraphOption, getJobMatrix} from './input-params'
|
||||||
|
|
||||||
const DEPENDENCY_GRAPH_ARTIFACT = 'dependency-graph'
|
const DEPENDENCY_GRAPH_ARTIFACT = 'dependency-graph'
|
||||||
|
|
||||||
export function setup(option: DependencyGraphOption): void {
|
export async function setup(option: DependencyGraphOption): Promise<void> {
|
||||||
if (option === DependencyGraphOption.Disabled || option === DependencyGraphOption.DownloadAndSubmit) {
|
if (option === DependencyGraphOption.Disabled) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// Download and submit early, for compatability with dependency review.
|
||||||
|
if (option === DependencyGraphOption.DownloadAndSubmit) {
|
||||||
|
await downloadAndSubmitDependencyGraphs()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +40,7 @@ export function setup(option: DependencyGraphOption): void {
|
||||||
export async function complete(option: DependencyGraphOption): Promise<void> {
|
export async function complete(option: DependencyGraphOption): Promise<void> {
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case DependencyGraphOption.Disabled:
|
case DependencyGraphOption.Disabled:
|
||||||
|
case DependencyGraphOption.DownloadAndSubmit: // Performed in setup
|
||||||
return
|
return
|
||||||
case DependencyGraphOption.Generate:
|
case DependencyGraphOption.Generate:
|
||||||
await uploadDependencyGraphs()
|
await uploadDependencyGraphs()
|
||||||
|
@ -42,8 +48,6 @@ export async function complete(option: DependencyGraphOption): Promise<void> {
|
||||||
case DependencyGraphOption.GenerateAndSubmit:
|
case DependencyGraphOption.GenerateAndSubmit:
|
||||||
await submitDependencyGraphs(await uploadDependencyGraphs())
|
await submitDependencyGraphs(await uploadDependencyGraphs())
|
||||||
return
|
return
|
||||||
case DependencyGraphOption.DownloadAndSubmit:
|
|
||||||
await downloadAndSubmitDependencyGraphs()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ export async function setup(): Promise<void> {
|
||||||
|
|
||||||
core.saveState(CACHE_LISTENER, cacheListener.stringify())
|
core.saveState(CACHE_LISTENER, cacheListener.stringify())
|
||||||
|
|
||||||
dependencyGraph.setup(params.getDependencyGraphOption())
|
await dependencyGraph.setup(params.getDependencyGraphOption())
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function complete(): Promise<void> {
|
export async function complete(): Promise<void> {
|
||||||
|
@ -62,7 +62,7 @@ export async function complete(): Promise<void> {
|
||||||
logJobSummary(buildResults, cacheListener)
|
logJobSummary(buildResults, cacheListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyGraph.complete(params.getDependencyGraphOption())
|
await dependencyGraph.complete(params.getDependencyGraphOption())
|
||||||
}
|
}
|
||||||
|
|
||||||
async function determineGradleUserHome(): Promise<string> {
|
async function determineGradleUserHome(): Promise<string> {
|
||||||
|
|
Loading…
Reference in a new issue