mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-07-05 23:05:54 +02:00
Allow flexible use of dependency-graph support
Adds a 'dependency-graph' parameter that has 4 options: 1. 'disabled': no dependency graph files generated (the default) 2. 'generate': dependency graph files will be generated and saved as artifacts. 3. 'generate-and-submit': dependency graph files will be generated, saved as artifacts, and submitted to the Dependency Submission API on job completion. 4. 'download-and-submit': any previously uploaded dependency graph artifacts will be downloaded and submitted to the Dependency Submission API.
This commit is contained in:
parent
820b228f28
commit
063cc1c708
5 changed files with 62 additions and 14 deletions
|
@ -67,6 +67,23 @@ export function isDependencyGraphEnabled(): boolean {
|
|||
return getBooleanInput('generate-dependency-graph', true)
|
||||
}
|
||||
|
||||
export function getDependencyGraphOption(): DependencyGraphOption {
|
||||
const val = core.getInput('dependency-graph')
|
||||
switch (val.toLowerCase().trim()) {
|
||||
case 'disabled':
|
||||
return DependencyGraphOption.Disabled
|
||||
case 'generate':
|
||||
return DependencyGraphOption.Generate
|
||||
case 'generate-and-submit':
|
||||
return DependencyGraphOption.GenerateAndSubmit
|
||||
case 'download-and-submit':
|
||||
return DependencyGraphOption.DownloadAndSubmit
|
||||
}
|
||||
throw TypeError(
|
||||
`The value '${val} is not valid for 'dependency-graph. Valid values are: [disabled, generate-and-upload, generate-and-submit, download-and-submit]. The default value is 'disabled'.`
|
||||
)
|
||||
}
|
||||
|
||||
function getBooleanInput(paramName: string, paramDefault = false): boolean {
|
||||
const paramValue = core.getInput(paramName)
|
||||
switch (paramValue.toLowerCase().trim()) {
|
||||
|
@ -79,3 +96,10 @@ function getBooleanInput(paramName: string, paramDefault = false): boolean {
|
|||
}
|
||||
throw TypeError(`The value '${paramValue} is not valid for '${paramName}. Valid values are: [true, false]`)
|
||||
}
|
||||
|
||||
export enum DependencyGraphOption {
|
||||
Disabled,
|
||||
Generate,
|
||||
GenerateAndSubmit,
|
||||
DownloadAndSubmit
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue