Unverified Commit 9bca466e authored by Daz DeBoer's avatar Daz DeBoer Committed by GitHub
Browse files

Make artifact retention configurable

- Added a new `artifact-retention-days` input parameter to control retention of uploaded artifacts
- Artifacts retention will use repository settings if not overridden.
parent f757bcfd
Loading
Loading
Loading
Loading
+9 −4
Changes for action.yml: 9 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -54,6 +54,11 @@ inputs:
  #      gradle-home-cache-excludes: |
  #           caches/build-cache-1

  gradle-home-cache-cleanup:
    description: When 'true', the action will attempt to remove any stale/unused entries from the Gradle User Home prior to saving to the GitHub Actions cache.
    required: false
    default: false

  arguments:
    description: Gradle command line arguments (supports multi-line input)
    required: false
@@ -68,6 +73,10 @@ inputs:
    required: false
    default: 'disabled'

  artifact-retention-days:
    description: Specifies the number of days to retain any artifacts generated by the action. If not set, the default retention settings for the repository will apply.
    required: false

  # EXPERIMENTAL & INTERNAL ACTION INPUTS
  # The following action properties allow fine-grained tweaking of the action caching behaviour.
  # These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
@@ -80,10 +89,6 @@ inputs:
    description: Used to uniquely identify the current job invocation. Defaults to the matrix values for this job; this should not be overridden by users (INTERNAL).
    required: false
    default: ${{ toJSON(matrix) }}
  gradle-home-cache-cleanup:
    description: When 'true', the action will attempt to remove any stale/unused entries from the Gradle User Home prior to saving to the GitHub Actions cache.
    required: false
    default: false

  github-token:
    description: The GitHub token used to authenticate when submitting via the Dependency Submission API.
+20 −2
Changes for dist/main/index.js: 20 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -93671,7 +93671,9 @@ function uploadDependencyGraphs() {
        const relativeGraphFiles = graphFiles.map(x => getRelativePathFromWorkspace(x));
        core.info(`Uploading dependency graph files: ${relativeGraphFiles}`);
        const artifactClient = artifact.create();
        artifactClient.uploadArtifact(DEPENDENCY_GRAPH_ARTIFACT, graphFiles, workspaceDirectory);
        artifactClient.uploadArtifact(DEPENDENCY_GRAPH_ARTIFACT, graphFiles, workspaceDirectory, {
            retentionDays: (0, input_params_1.getArtifactRetentionDays)()
        });
        return graphFiles;
    });
}
@@ -93979,7 +93981,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
    return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DependencyGraphOption = exports.getDependencyGraphOption = exports.isDependencyGraphEnabled = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphOption = exports.isDependencyGraphEnabled = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
const core = __importStar(__nccwpck_require__(2186));
const string_argv_1 = __nccwpck_require__(9663);
function isCacheDisabled() {
@@ -94066,6 +94068,22 @@ function getDependencyGraphOption() {
    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'.`);
}
exports.getDependencyGraphOption = getDependencyGraphOption;
function getArtifactRetentionDays() {
    const val = core.getInput('artifact-retention-days');
    return parseNumericInput('artifact-retention-days', val, 0);
}
exports.getArtifactRetentionDays = getArtifactRetentionDays;
function parseNumericInput(paramName, paramValue, paramDefault) {
    if (paramValue.length === 0) {
        return paramDefault;
    }
    const numericValue = parseInt(paramValue);
    if (isNaN(numericValue)) {
        throw TypeError(`The value '${paramValue}' is not a valid numeric value for '${paramName}'.`);
    }
    return numericValue;
}
exports.parseNumericInput = parseNumericInput;
function getBooleanInput(paramName, paramDefault = false) {
    const paramValue = core.getInput(paramName);
    switch (paramValue.toLowerCase().trim()) {
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+20 −2
Changes for dist/post/index.js: 20 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -93671,7 +93671,9 @@ function uploadDependencyGraphs() {
        const relativeGraphFiles = graphFiles.map(x => getRelativePathFromWorkspace(x));
        core.info(`Uploading dependency graph files: ${relativeGraphFiles}`);
        const artifactClient = artifact.create();
        artifactClient.uploadArtifact(DEPENDENCY_GRAPH_ARTIFACT, graphFiles, workspaceDirectory);
        artifactClient.uploadArtifact(DEPENDENCY_GRAPH_ARTIFACT, graphFiles, workspaceDirectory, {
            retentionDays: (0, input_params_1.getArtifactRetentionDays)()
        });
        return graphFiles;
    });
}
@@ -93847,7 +93849,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
    return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DependencyGraphOption = exports.getDependencyGraphOption = exports.isDependencyGraphEnabled = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphOption = exports.isDependencyGraphEnabled = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
const core = __importStar(__nccwpck_require__(2186));
const string_argv_1 = __nccwpck_require__(9663);
function isCacheDisabled() {
@@ -93934,6 +93936,22 @@ function getDependencyGraphOption() {
    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'.`);
}
exports.getDependencyGraphOption = getDependencyGraphOption;
function getArtifactRetentionDays() {
    const val = core.getInput('artifact-retention-days');
    return parseNumericInput('artifact-retention-days', val, 0);
}
exports.getArtifactRetentionDays = getArtifactRetentionDays;
function parseNumericInput(paramName, paramValue, paramDefault) {
    if (paramValue.length === 0) {
        return paramDefault;
    }
    const numericValue = parseInt(paramValue);
    if (isNaN(numericValue)) {
        throw TypeError(`The value '${paramValue}' is not a valid numeric value for '${paramName}'.`);
    }
    return numericValue;
}
exports.parseNumericInput = parseNumericInput;
function getBooleanInput(paramName, paramDefault = false) {
    const paramValue = core.getInput(paramName);
    switch (paramValue.toLowerCase().trim()) {
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

Loading