mirror of
https://code.forgejo.org/forgejo/download-artifact.git
synced 2025-05-16 12:27:47 +02:00
Misc Download Artifact Improvements (#43)
* Various improvements to download-artifact * Resolve input path * README updates * PR feedback
This commit is contained in:
parent
385ad92b52
commit
7e5b6f00de
6 changed files with 286 additions and 125 deletions
11
dist/index.js
vendored
11
dist/index.js
vendored
|
@ -6581,6 +6581,10 @@ var Inputs;
|
|||
Inputs["Name"] = "name";
|
||||
Inputs["Path"] = "path";
|
||||
})(Inputs = exports.Inputs || (exports.Inputs = {}));
|
||||
var Outputs;
|
||||
(function (Outputs) {
|
||||
Outputs["DownloadPath"] = "download-path";
|
||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -6630,6 +6634,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const artifact = __importStar(__webpack_require__(214));
|
||||
const path_1 = __webpack_require__(622);
|
||||
const constants_1 = __webpack_require__(694);
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
@ -6639,6 +6644,8 @@ function run() {
|
|||
const artifactClient = artifact.create();
|
||||
if (!name) {
|
||||
// download all artifacts
|
||||
core.info('No artifact name specified, downloading all artifacts');
|
||||
core.info('Creating an extra directory for each artifact that is being downloaded');
|
||||
const downloadResponse = yield artifactClient.downloadAllArtifacts(path);
|
||||
core.info(`There were ${downloadResponse.length} artifacts downloaded`);
|
||||
for (const artifact of downloadResponse) {
|
||||
|
@ -6647,12 +6654,16 @@ function run() {
|
|||
}
|
||||
else {
|
||||
// download a single artifact
|
||||
core.info(`Starting download for ${name}`);
|
||||
const downloadOptions = {
|
||||
createArtifactFolder: false
|
||||
};
|
||||
const downloadResponse = yield artifactClient.downloadArtifact(name, path, downloadOptions);
|
||||
core.info(`Artifact ${downloadResponse.artifactName} was downloaded to ${downloadResponse.downloadPath}`);
|
||||
}
|
||||
// output the directory that the artifact(s) was/were downloaded to
|
||||
// if no path is provided, an empty string resolves to the current working directory
|
||||
core.setOutput(constants_1.Outputs.DownloadPath, path_1.resolve(path));
|
||||
core.info('Artifact download has finished successfully');
|
||||
}
|
||||
catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue