mirror of
https://github.com/actions/download-artifact.git
synced 2025-07-26 16:38:28 +02:00
Fix download
Signed-off-by: Eli Uriegas <eliuriegas@fb.com>
This commit is contained in:
parent
ed1916672d
commit
576971f47f
3 changed files with 35 additions and 48 deletions
47
dist/index.js
vendored
47
dist/index.js
vendored
|
@ -19,13 +19,7 @@ module.exports =
|
||||||
/******/ };
|
/******/ };
|
||||||
/******/
|
/******/
|
||||||
/******/ // Execute the module function
|
/******/ // Execute the module function
|
||||||
/******/ var threw = true;
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||||
/******/ try {
|
|
||||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
||||||
/******/ threw = false;
|
|
||||||
/******/ } finally {
|
|
||||||
/******/ if(threw) delete installedModules[moduleId];
|
|
||||||
/******/ }
|
|
||||||
/******/
|
/******/
|
||||||
/******/ // Flag the module as loaded
|
/******/ // Flag the module as loaded
|
||||||
/******/ module.l = true;
|
/******/ module.l = true;
|
||||||
|
@ -5450,7 +5444,6 @@ module.exports = {"metadata":{"apiVersion":"2017-07-25","endpointPrefix":"dataex
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.Outputs = exports.Inputs = void 0;
|
|
||||||
var Inputs;
|
var Inputs;
|
||||||
(function (Inputs) {
|
(function (Inputs) {
|
||||||
Inputs["Name"] = "name";
|
Inputs["Name"] = "name";
|
||||||
|
@ -24762,7 +24755,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
var request = __webpack_require__(1753);
|
var request = __webpack_require__(1753);
|
||||||
var universalUserAgent = __webpack_require__(6796);
|
var universalUserAgent = __webpack_require__(6796);
|
||||||
|
|
||||||
const VERSION = "4.6.2";
|
const VERSION = "4.6.1";
|
||||||
|
|
||||||
class GraphqlError extends Error {
|
class GraphqlError extends Error {
|
||||||
constructor(request, response) {
|
constructor(request, response) {
|
||||||
|
@ -29858,7 +29851,6 @@ exports.getInput = getInput;
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function setOutput(name, value) {
|
function setOutput(name, value) {
|
||||||
process.stdout.write(os.EOL);
|
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
command_1.issueCommand('set-output', { name }, value);
|
||||||
}
|
}
|
||||||
exports.setOutput = setOutput;
|
exports.setOutput = setOutput;
|
||||||
|
@ -31128,25 +31120,6 @@ exports.getUserAgent = getUserAgent;
|
||||||
|
|
||||||
"use strict";
|
"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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
@ -31156,6 +31129,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
|
@ -31194,14 +31174,17 @@ function run() {
|
||||||
if (!fileObject.Key) {
|
if (!fileObject.Key) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
core.info(`Grabbing ${fileObject.Key}`);
|
const localKey = fileObject.Key.replace(s3Prefix, '');
|
||||||
|
core.info(`Downloading ${localKey}`);
|
||||||
|
core.debug(`S3 download uri: s3://${s3Bucket}/${fileObject.Key}`);
|
||||||
s3.getObject({ Bucket: s3Bucket, Key: fileObject.Key }, function (err, fileContents) {
|
s3.getObject({ Bucket: s3Bucket, Key: fileObject.Key }, function (err, fileContents) {
|
||||||
var _a;
|
var _a;
|
||||||
if (err) {
|
if (err) {
|
||||||
core.error(err);
|
core.error(`Error downloading ${localKey}`);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
fs.writeFileSync(path_1.default.resolve(resolvedPath, fileObject.Key), (_a = fileContents.Body) === null || _a === void 0 ? void 0 : _a.toString());
|
fs.writeFileSync(path_1.default.resolve(resolvedPath, localKey), (_a = fileContents.Body) === null || _a === void 0 ? void 0 : _a.toString());
|
||||||
|
core.info(`DONE: ${localKey}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -3985,7 +3985,8 @@
|
||||||
"version": "5.3.1",
|
"version": "5.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
|
||||||
"integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
|
"integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"requires": {}
|
||||||
},
|
},
|
||||||
"ajv": {
|
"ajv": {
|
||||||
"version": "6.12.6",
|
"version": "6.12.6",
|
||||||
|
@ -4507,7 +4508,8 @@
|
||||||
"version": "8.3.0",
|
"version": "8.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz",
|
||||||
"integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==",
|
"integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"requires": {}
|
||||||
},
|
},
|
||||||
"eslint-import-resolver-node": {
|
"eslint-import-resolver-node": {
|
||||||
"version": "0.3.4",
|
"version": "0.3.4",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as artifact from '@actions/artifact'
|
|
||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
import * as AWS from 'aws-sdk'
|
import * as AWS from 'aws-sdk'
|
||||||
import * as os from 'os'
|
import * as os from 'os'
|
||||||
|
@ -33,20 +32,23 @@ async function run(): Promise<void> {
|
||||||
if (!fileObject.Key) {
|
if (!fileObject.Key) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
core.info(`Grabbing ${fileObject.Key}`)
|
const localKey = fileObject.Key.replace(s3Prefix, '')
|
||||||
s3.getObject(
|
core.info(`Downloading ${localKey}`)
|
||||||
{Bucket: s3Bucket, Key: fileObject.Key},
|
core.debug(`S3 download uri: s3://${s3Bucket}/${fileObject.Key}`)
|
||||||
function (err, fileContents) {
|
s3.getObject({Bucket: s3Bucket, Key: fileObject.Key}, function (
|
||||||
if (err) {
|
err,
|
||||||
core.error(err)
|
fileContents
|
||||||
throw err
|
) {
|
||||||
}
|
if (err) {
|
||||||
fs.writeFileSync(
|
core.error(`Error downloading ${localKey}`)
|
||||||
path.resolve(resolvedPath, fileObject.Key as string),
|
throw err
|
||||||
fileContents.Body?.toString()
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
)
|
fs.writeFileSync(
|
||||||
|
path.resolve(resolvedPath, localKey),
|
||||||
|
fileContents.Body?.toString()
|
||||||
|
)
|
||||||
|
core.info(`DONE: ${localKey}`)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// output the directory that the artifact(s) was/were downloaded to
|
// output the directory that the artifact(s) was/were downloaded to
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue