Update index.js
This commit is contained in:
parent
77aa5ad6e4
commit
a0b83ead13
|
@ -120473,6 +120473,7 @@ var Inputs;
|
||||||
Inputs["RunID"] = "run-id";
|
Inputs["RunID"] = "run-id";
|
||||||
Inputs["Pattern"] = "pattern";
|
Inputs["Pattern"] = "pattern";
|
||||||
Inputs["MergeMultiple"] = "merge-multiple";
|
Inputs["MergeMultiple"] = "merge-multiple";
|
||||||
|
Inputs["AllowNotFound"] = "allow-not-found";
|
||||||
})(Inputs || (exports.Inputs = Inputs = {}));
|
})(Inputs || (exports.Inputs = Inputs = {}));
|
||||||
var Outputs;
|
var Outputs;
|
||||||
(function (Outputs) {
|
(function (Outputs) {
|
||||||
|
@ -120546,7 +120547,10 @@ function run() {
|
||||||
repository: core.getInput(constants_1.Inputs.Repository, { required: false }),
|
repository: core.getInput(constants_1.Inputs.Repository, { required: false }),
|
||||||
runID: parseInt(core.getInput(constants_1.Inputs.RunID, { required: false })),
|
runID: parseInt(core.getInput(constants_1.Inputs.RunID, { required: false })),
|
||||||
pattern: core.getInput(constants_1.Inputs.Pattern, { required: false }),
|
pattern: core.getInput(constants_1.Inputs.Pattern, { required: false }),
|
||||||
mergeMultiple: core.getBooleanInput(constants_1.Inputs.MergeMultiple, { required: false })
|
mergeMultiple: core.getBooleanInput(constants_1.Inputs.MergeMultiple, {
|
||||||
|
required: false
|
||||||
|
}),
|
||||||
|
allowNotFound: core.getBooleanInput(constants_1.Inputs.AllowNotFound, { required: false })
|
||||||
};
|
};
|
||||||
if (!inputs.path) {
|
if (!inputs.path) {
|
||||||
inputs.path = process.env['GITHUB_WORKSPACE'] || process.cwd();
|
inputs.path = process.env['GITHUB_WORKSPACE'] || process.cwd();
|
||||||
|
@ -120555,7 +120559,7 @@ function run() {
|
||||||
inputs.path = inputs.path.replace('~', os.homedir());
|
inputs.path = inputs.path.replace('~', os.homedir());
|
||||||
}
|
}
|
||||||
const isSingleArtifactDownload = !!inputs.name;
|
const isSingleArtifactDownload = !!inputs.name;
|
||||||
const resolvedPath = path.resolve(inputs.path);
|
let resolvedPath = path.resolve(inputs.path);
|
||||||
core.debug(`Resolved path is ${resolvedPath}`);
|
core.debug(`Resolved path is ${resolvedPath}`);
|
||||||
const options = {};
|
const options = {};
|
||||||
if (inputs.token) {
|
if (inputs.token) {
|
||||||
|
@ -120573,12 +120577,23 @@ function run() {
|
||||||
let artifacts = [];
|
let artifacts = [];
|
||||||
if (isSingleArtifactDownload) {
|
if (isSingleArtifactDownload) {
|
||||||
core.info(`Downloading single artifact`);
|
core.info(`Downloading single artifact`);
|
||||||
const { artifact: targetArtifact } = yield artifact_1.default.getArtifact(inputs.name, options);
|
const targetArtifact = yield artifact_1.default
|
||||||
|
.getArtifact(inputs.name, options)
|
||||||
|
.catch(() => null);
|
||||||
if (!targetArtifact) {
|
if (!targetArtifact) {
|
||||||
throw new Error(`Artifact '${inputs.name}' not found`);
|
const message = `Artifact '${inputs.name}' not found`;
|
||||||
|
if (!inputs.allowNotFound) {
|
||||||
|
throw new Error(message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.warning(message);
|
||||||
|
resolvedPath = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.debug(`Found named artifact '${inputs.name}' (ID: ${targetArtifact.artifact.id}, Size: ${targetArtifact.artifact.size})`);
|
||||||
|
artifacts = [targetArtifact.artifact];
|
||||||
}
|
}
|
||||||
core.debug(`Found named artifact '${inputs.name}' (ID: ${targetArtifact.id}, Size: ${targetArtifact.size})`);
|
|
||||||
artifacts = [targetArtifact];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const listArtifactResponse = yield artifact_1.default.listArtifacts(Object.assign({ latest: true }, options));
|
const listArtifactResponse = yield artifact_1.default.listArtifacts(Object.assign({ latest: true }, options));
|
||||||
|
|
Loading…
Reference in New Issue