Skip to content

add artifact-retention-days input #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
matrix-key:
required: false
description: "Matrix key"
artifact-retention-days:
required: false
default: "90"
description: "Artifact retention day"
outputs:
required: false
description: "YAML structured map of outputs"
Expand Down
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const fs = require('fs');
try {
const step_name = core.getInput('matrix-step-name');
const matrix_key = core.getInput('matrix-key');
const artifact_retention_days = core.getInput('artifact-retention-days');
const outputs = core.getInput('outputs');

core.debug("step_name:")
Expand All @@ -15,6 +16,9 @@ try {
core.debug("matrix_key:")
core.debug(matrix_key)

core.debug("artifact_retention_days:")
core.debug(artifact_retention_days)

core.debug("outputs:")
core.debug(outputs)

Expand All @@ -34,6 +38,11 @@ try {

const matrix_mode = !isEmptyInput(step_name) && !isEmptyInput(matrix_key)

if (!parseInt(artifact_retention_days, 10)) {
core.setFailed("`artifact-retention-days` can not be non integer");
return
}

if (!isEmptyInput(outputs)) {
try {
yaml.parse(outputs)
Expand Down Expand Up @@ -81,7 +90,8 @@ ${error}`;

const rootDirectory = '.' // Also possible to use __dirname
const options = {
continueOnError: false
continueOnError: false,
retentionDays: parseInt(artifact_retention_days, 10)
}

artifactClient.uploadArtifact(artifactName, files, rootDirectory, options)
Expand Down