From 9e459adb1197099a1124ea36df0b0942a12682bc Mon Sep 17 00:00:00 2001 From: daz Date: Fri, 19 Jul 2024 16:20:52 -0600 Subject: [PATCH] Add 'dependency-graph-report-dir' input parameter --- .github/workflows/integ-test-dependency-submission.yml | 10 ++++------ dependency-submission/action.yml | 7 +++++++ docs/dependency-submission.md | 7 +++++++ setup-gradle/action.yml | 7 +++++++ sources/src/configuration.ts | 3 ++- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integ-test-dependency-submission.yml b/.github/workflows/integ-test-dependency-submission.yml index 430a67c..41111c8 100644 --- a/.github/workflows/integ-test-dependency-submission.yml +++ b/.github/workflows/integ-test-dependency-submission.yml @@ -279,9 +279,8 @@ jobs: uses: ./dependency-submission with: dependency-graph: generate-and-submit + dependency-graph-report-dir: '${{ github.workspace }}/custom/report-dir' build-root-directory: .github/workflow-samples/groovy-dsl - env: - DEPENDENCY_GRAPH_REPORT_DIR: '${{ github.workspace }}/custom/report-dir' - name: Check generated dependency graphs shell: bash run: | @@ -310,9 +309,8 @@ jobs: uses: ./dependency-submission with: dependency-graph: generate-and-upload + dependency-graph-report-dir: '${{ github.workspace }}/custom/report-dir' build-root-directory: .github/workflow-samples/groovy-dsl - env: - DEPENDENCY_GRAPH_REPORT_DIR: '${{ github.workspace }}/custom/report-dir' custom-report-dir-download-and-submit: needs: custom-report-dir-upload @@ -327,10 +325,10 @@ jobs: uses: ./dependency-submission with: dependency-graph: download-and-submit + dependency-graph-report-dir: '${{ github.workspace }}/custom/report-dir' build-root-directory: .github/workflow-samples/groovy-dsl env: - DEPENDENCY_GRAPH_REPORT_DIR: '${{ github.workspace }}/custom/report-dir' - DEPENDENCY_GRAPH_DOWNLOAD_ARTIFACT_NAME: custom-report-dir-upload + DEPENDENCY_GRAPH_DOWNLOAD_ARTIFACT_NAME: custom-report-dir-upload # For testing, to avoid downloading artifacts from other worklfows - name: Check downloaded dependency graph shell: bash diff --git a/dependency-submission/action.yml b/dependency-submission/action.yml index e062cb3..a9d07e8 100644 --- a/dependency-submission/action.yml +++ b/dependency-submission/action.yml @@ -108,6 +108,13 @@ inputs: required: false default: 'generate-and-submit' + dependency-graph-report-dir: + description: | + Specifies where the dependency graph report will be generated. + Paths can relative or absolute. Relative paths are resolved relative to the workspace directory. + required: false + default: 'dependency-graph-reports' + dependency-graph-continue-on-failure: description: When 'false' a failure to generate or submit a dependency graph will fail the Step or Job. When 'true' a warning will be emitted but no failure will result. required: false diff --git a/docs/dependency-submission.md b/docs/dependency-submission.md index 844c12e..f4e3641 100644 --- a/docs/dependency-submission.md +++ b/docs/dependency-submission.md @@ -102,6 +102,13 @@ In some cases, the default action configuration will not be sufficient, and addi # Do not attempt to submit the dependency-graph. Save it as a workflow artifact. dependency-graph: generate-and-upload + + # Specify the location where dependency graph files will be generated. + dependency-graph-report-dir: custom-report-dir + + # By default, failure to generate a dependency graph will cause the workflow to fail + dependency-graph-continue-on-failure: true + ``` See the [Action Metadata file](../dependency-submission/action.yml) for a more detailed description of each input parameter. diff --git a/setup-gradle/action.yml b/setup-gradle/action.yml index c6c4efb..c4a30cf 100644 --- a/setup-gradle/action.yml +++ b/setup-gradle/action.yml @@ -84,6 +84,13 @@ inputs: required: false default: 'disabled' + dependency-graph-report-dir: + description: | + Specifies where the dependency graph report will be generated. + Paths can relative or absolute. Relative paths are resolved relative to the workspace directory. + required: false + default: 'dependency-graph-reports' + dependency-graph-continue-on-failure: description: When 'false' a failure to generate or submit a dependency graph will fail the Step or Job. When 'true' a warning will be emitted but no failure will result. required: false diff --git a/sources/src/configuration.ts b/sources/src/configuration.ts index 2828346..a113cc8 100644 --- a/sources/src/configuration.ts +++ b/sources/src/configuration.ts @@ -43,7 +43,8 @@ export class DependencyGraphConfig { } getReportDirectory(): string { - return path.resolve(getWorkspaceDirectory(), 'dependency-graph-reports') + const param = core.getInput('dependency-graph-report-dir') + return path.resolve(getWorkspaceDirectory(), param) } getDownloadArtifactName(): string | undefined {