mirror of
https://github.com/trympet/nextcloud-artifacts-action.git
synced 2025-04-24 20:16:08 +02:00
update files
This commit is contained in:
parent
0141d42d10
commit
aae7f9ffbb
73
dist/NextcloudArtifact.js
vendored
73
dist/NextcloudArtifact.js
vendored
@ -1,73 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NextcloudArtifact = void 0;
|
||||
const core_1 = __importDefault(require("@actions/core"));
|
||||
const FileFinder_1 = require("./FileFinder");
|
||||
const Inputs_1 = require("./Inputs");
|
||||
const NextcloudClient_1 = require("./nextcloud/NextcloudClient");
|
||||
const NoFileOption_1 = require("./NoFileOption");
|
||||
class NextcloudArtifact {
|
||||
constructor(name, path, errorBehavior) {
|
||||
this.name = name;
|
||||
this.path = path;
|
||||
this.errorBehavior = errorBehavior;
|
||||
}
|
||||
run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const fileFinder = new FileFinder_1.FileFinder(this.path);
|
||||
const files = yield fileFinder.findFiles();
|
||||
if (files.filesToUpload.length > 0) {
|
||||
yield this.uploadFiles(files);
|
||||
}
|
||||
else {
|
||||
this.logNoFilesFound();
|
||||
}
|
||||
});
|
||||
}
|
||||
uploadFiles(files) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
this.logUpload(files.filesToUpload.length, files.rootDirectory);
|
||||
const client = new NextcloudClient_1.NextcloudClient(Inputs_1.Inputs.endpoint, this.name, files.rootDirectory);
|
||||
yield client.uploadFiles(files.filesToUpload);
|
||||
});
|
||||
}
|
||||
logUpload(fileCount, rootDirectory) {
|
||||
const s = fileCount === 1 ? '' : 's';
|
||||
core_1.default.info(`With the provided path, there will be ${fileCount} file${s} uploaded`);
|
||||
core_1.default.debug(`Root artifact directory is ${rootDirectory}`);
|
||||
if (fileCount > 10000) {
|
||||
core_1.default.warning(`There are over 10,000 files in this artifact, consider create an archive before upload to improve the upload performance.`);
|
||||
}
|
||||
}
|
||||
logNoFilesFound() {
|
||||
const errorMessage = `No files were found with the provided path: ${this.path}. No artifacts will be uploaded.`;
|
||||
switch (this.errorBehavior) {
|
||||
case NoFileOption_1.NoFileOption.warn: {
|
||||
core_1.default.warning(errorMessage);
|
||||
break;
|
||||
}
|
||||
case NoFileOption_1.NoFileOption.error: {
|
||||
core_1.default.setFailed(errorMessage);
|
||||
break;
|
||||
}
|
||||
case NoFileOption_1.NoFileOption.ignore: {
|
||||
core_1.default.info(errorMessage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.NextcloudArtifact = NextcloudArtifact;
|
||||
//# sourceMappingURL=NextcloudArtifact.js.map
|
1
dist/NextcloudArtifact.js.map
vendored
1
dist/NextcloudArtifact.js.map
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"NextcloudArtifact.js","sourceRoot":"","sources":["../src/NextcloudArtifact.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yDAAiC;AACjC,6CAA0C;AAC1C,qCAAkC;AAClC,iEAA8D;AAC9D,iDAA8C;AAE9C,MAAa,iBAAiB;IAC1B,YACY,IAAY,EACZ,IAAY,EACZ,aAA2B;QAF3B,SAAI,GAAJ,IAAI,CAAQ;QACZ,SAAI,GAAJ,IAAI,CAAQ;QACZ,kBAAa,GAAb,aAAa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I,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;gBAC3B,MAAM;aACT;YACD,KAAK,2BAAY,CAAC,KAAK,CAAC,CAAC;gBACrB,cAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;gBAC7B,MAAM;aACT;YACD,KAAK,2BAAY,CAAC,MAAM,CAAC,CAAC;gBACtB,cAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACxB,MAAM;aACT;SACJ;IACL,CAAC;CACJ;AAzDD,8CAyDC"}
|
30715
dist/index.js
vendored
30715
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
1
dist/index.js.map
vendored
1
dist/index.js.map
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,qCAAkC;AAClC,qEAAkE;AAElE,IAAI,QAAQ,GAAG,IAAI,qCAAiB,CAAC,eAAM,CAAC,YAAY,EAAE,eAAM,CAAC,YAAY,EAAE,eAAM,CAAC,cAAc,CAAC,CAAC;AACtG,QAAQ,CAAC,GAAG,EAAE,CAAC"}
|
51
dist/input-helper.js
vendored
51
dist/input-helper.js
vendored
@ -1,51 +0,0 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getInputs = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const constants_1 = require("./constants");
|
||||
/**
|
||||
* Helper to get all the inputs for the action
|
||||
*/
|
||||
function getInputs() {
|
||||
const name = core.getInput(constants_1.Inputs.Name);
|
||||
const path = core.getInput(constants_1.Inputs.Path, { required: true });
|
||||
const ifNoFilesFound = core.getInput(constants_1.Inputs.IfNoFilesFound);
|
||||
const noFileBehavior = constants_1.NoFileOptions[ifNoFilesFound];
|
||||
if (!noFileBehavior) {
|
||||
core.setFailed(`Unrecognized ${constants_1.Inputs.IfNoFilesFound} input. Provided: ${ifNoFilesFound}. Available options: ${Object.keys(constants_1.NoFileOptions)}`);
|
||||
}
|
||||
const inputs = {
|
||||
artifactName: name,
|
||||
searchPath: path,
|
||||
ifNoFilesFound: noFileBehavior
|
||||
};
|
||||
const retentionDaysStr = core.getInput(constants_1.Inputs.RetentionDays);
|
||||
if (retentionDaysStr) {
|
||||
inputs.retentionDays = parseInt(retentionDaysStr);
|
||||
if (isNaN(inputs.retentionDays)) {
|
||||
core.setFailed('Invalid retention-days');
|
||||
}
|
||||
}
|
||||
return inputs;
|
||||
}
|
||||
exports.getInputs = getInputs;
|
||||
//# sourceMappingURL=input-helper.js.map
|
1
dist/input-helper.js.map
vendored
1
dist/input-helper.js.map
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"input-helper.js","sourceRoot":"","sources":["../src/input-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AACrC,2CAAiD;AAGjD;;GAEG;AACH,SAAgB,SAAS;IACvB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,kBAAM,CAAC,IAAI,CAAC,CAAA;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,kBAAM,CAAC,IAAI,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAA;IAEzD,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,kBAAM,CAAC,cAAc,CAAC,CAAA;IAC3D,MAAM,cAAc,GAAkB,yBAAa,CAAC,cAAc,CAAC,CAAA;IAEnE,IAAI,CAAC,cAAc,EAAE;QACnB,IAAI,CAAC,SAAS,CACZ,gBACE,kBAAM,CAAC,cACT,qBAAqB,cAAc,wBAAwB,MAAM,CAAC,IAAI,CACpE,yBAAa,CACd,EAAE,CACJ,CAAA;KACF;IAED,MAAM,MAAM,GAAG;QACb,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;QAChB,cAAc,EAAE,cAAc;KACf,CAAA;IAEjB,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,kBAAM,CAAC,aAAa,CAAC,CAAA;IAC5D,IAAI,gBAAgB,EAAE;QACpB,MAAM,CAAC,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAA;QACjD,IAAI,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;YAC/B,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAA;SACzC;KACF;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAhCD,8BAgCC"}
|
3
dist/upload-inputs.js
vendored
3
dist/upload-inputs.js
vendored
@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=upload-inputs.js.map
|
1
dist/upload-inputs.js.map
vendored
1
dist/upload-inputs.js.map
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"upload-inputs.js","sourceRoot":"","sources":["../src/upload-inputs.ts"],"names":[],"mappings":""}
|
7
lib/nextcloud-artifacts.js
Normal file
7
lib/nextcloud-artifacts.js
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const Inputs_1 = require("./Inputs");
|
||||
const NextcloudArtifact_1 = require("./nextcloud/NextcloudArtifact");
|
||||
var artifact = new NextcloudArtifact_1.NextcloudArtifact(Inputs_1.Inputs.ArtifactName, Inputs_1.Inputs.ArtifactPath, Inputs_1.Inputs.NoFileBehvaior);
|
||||
artifact.run();
|
||||
//# sourceMappingURL=nextcloud-artifacts.js.map
|
1
lib/nextcloud-artifacts.js.map
Normal file
1
lib/nextcloud-artifacts.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"nextcloud-artifacts.js","sourceRoot":"","sources":["../src/nextcloud-artifacts.ts"],"names":[],"mappings":";;AAAA,qCAAkC;AAClC,qEAAkE;AAElE,IAAI,QAAQ,GAAG,IAAI,qCAAiB,CAAC,eAAM,CAAC,YAAY,EAAE,eAAM,CAAC,YAAY,EAAE,eAAM,CAAC,cAAc,CAAC,CAAC;AACtG,QAAQ,CAAC,GAAG,EAAE,CAAC"}
|
Loading…
x
Reference in New Issue
Block a user