mirror of
https://github.com/actions/upload-artifact.git
synced 2025-06-24 08:36:12 +02:00
Merge c7b5199c2b
into a8a3f3ad30
This commit is contained in:
commit
f7eecb5bc4
8 changed files with 51 additions and 6 deletions
16
dist/index.js
vendored
16
dist/index.js
vendored
|
@ -10745,6 +10745,7 @@ var Inputs;
|
|||
Inputs["Path"] = "path";
|
||||
Inputs["IfNoFilesFound"] = "if-no-files-found";
|
||||
Inputs["RetentionDays"] = "retention-days";
|
||||
Inputs["RootDirectory"] = "root-directory";
|
||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||
var NoFileOptions;
|
||||
(function (NoFileOptions) {
|
||||
|
@ -10803,6 +10804,7 @@ const constants_1 = __nccwpck_require__(9042);
|
|||
function getInputs() {
|
||||
const name = core.getInput(constants_1.Inputs.Name);
|
||||
const path = core.getInput(constants_1.Inputs.Path, { required: true });
|
||||
const rootDirectory = core.getInput(constants_1.Inputs.RootDirectory);
|
||||
const ifNoFilesFound = core.getInput(constants_1.Inputs.IfNoFilesFound);
|
||||
const noFileBehavior = constants_1.NoFileOptions[ifNoFilesFound];
|
||||
if (!noFileBehavior) {
|
||||
|
@ -10811,7 +10813,8 @@ function getInputs() {
|
|||
const inputs = {
|
||||
artifactName: name,
|
||||
searchPath: path,
|
||||
ifNoFilesFound: noFileBehavior
|
||||
ifNoFilesFound: noFileBehavior,
|
||||
rootDirectory: rootDirectory
|
||||
};
|
||||
const retentionDaysStr = core.getInput(constants_1.Inputs.RetentionDays);
|
||||
if (retentionDaysStr) {
|
||||
|
@ -10931,7 +10934,7 @@ function getMultiPathLCA(searchPaths) {
|
|||
}
|
||||
return path.join(...commonPaths);
|
||||
}
|
||||
function findFilesToUpload(searchPath, globOptions) {
|
||||
function findFilesToUpload(searchPath, manualRootDirectory, globOptions) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const searchResults = [];
|
||||
const globber = yield glob.create(searchPath, globOptions || getDefaultGlobOptions());
|
||||
|
@ -10963,6 +10966,13 @@ function findFilesToUpload(searchPath, globOptions) {
|
|||
(0, core_1.debug)(`Removing ${searchResult} from rawSearchResults because it is a directory`);
|
||||
}
|
||||
}
|
||||
// Root directory manually set in inputs
|
||||
if (manualRootDirectory) {
|
||||
return {
|
||||
filesToUpload: searchResults,
|
||||
rootDirectory: manualRootDirectory
|
||||
};
|
||||
}
|
||||
// Calculate the root directory for the artifact using the search paths that were utilized
|
||||
const searchPaths = globber.getSearchPaths();
|
||||
if (searchPaths.length > 1) {
|
||||
|
@ -11042,7 +11052,7 @@ function run() {
|
|||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const inputs = (0, input_helper_1.getInputs)();
|
||||
const searchResult = yield (0, search_1.findFilesToUpload)(inputs.searchPath);
|
||||
const searchResult = yield (0, search_1.findFilesToUpload)(inputs.searchPath, inputs.rootDirectory);
|
||||
if (searchResult.filesToUpload.length === 0) {
|
||||
// No files were found, different use cases warrant different types of behavior if nothing is found
|
||||
switch (inputs.ifNoFilesFound) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue