Skip to content

Commit ce46532

Browse files
committed
Repackage action following @actions/tool-cache bump
GitHub downloads each action run in a workflow during runtime and executes it as a complete package of code before you can use workflow commands like run to interact with the runner machine. This means that we must provide all JavaScript package dependencies as part of the distributed action in order for it to be usable in workflows. A naive approach to doing this is checking in the `node_modules` folder. However, this approach results in a huge amount of frequently changing external content being included in the repository, much of which is not even part of the executed program. A far better approach is to use the excellent ncc tool to compile the program, including all the relevant code from the dependencies, into a single file. We use a "continuous packaging" approach, where the packaged action code that is generated via ncc is always kept in sync with the development source code and dependencies. This allows a beta version of the action to be easily used in workflows by beta testers or those who need changes not in the release simply by using the name of the branch as the action ref (e.g., `uses: arduino/arduino-lint-action@main` will cause the version of the action from the tip of the `main` branch to be used by the workflow run). The update of the package dependency results in a change to the packaged code, so the packaging is here updated accordingly.
1 parent a989857 commit ce46532

File tree

1 file changed

+39
-117
lines changed

1 file changed

+39
-117
lines changed

dist/index.js

Lines changed: 39 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -3581,7 +3581,11 @@ function copyFile(srcFile, destFile, force) {
35813581

35823582
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
35833583
if (k2 === undefined) k2 = k;
3584-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3584+
var desc = Object.getOwnPropertyDescriptor(m, k);
3585+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3586+
desc = { enumerable: true, get: function() { return m[k]; } };
3587+
}
3588+
Object.defineProperty(o, k2, desc);
35853589
}) : (function(o, m, k, k2) {
35863590
if (k2 === undefined) k2 = k;
35873591
o[k2] = m[k];
@@ -3594,7 +3598,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35943598
var __importStar = (this && this.__importStar) || function (mod) {
35953599
if (mod && mod.__esModule) return mod;
35963600
var result = {};
3597-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3601+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
35983602
__setModuleDefault(result, mod);
35993603
return result;
36003604
};
@@ -3624,11 +3628,11 @@ function _findMatch(versionSpec, stable, candidates, archFilter) {
36243628
let file;
36253629
for (const candidate of candidates) {
36263630
const version = candidate.version;
3627-
core_1.debug(`check ${version} satisfies ${versionSpec}`);
3631+
(0, core_1.debug)(`check ${version} satisfies ${versionSpec}`);
36283632
if (semver.satisfies(version, versionSpec) &&
36293633
(!stable || candidate.stable === stable)) {
36303634
file = candidate.files.find(item => {
3631-
core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`);
3635+
(0, core_1.debug)(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`);
36323636
let chk = item.arch === archFilter && item.platform === platFilter;
36333637
if (chk && item.platform_version) {
36343638
const osVersion = module.exports._getOsVersion();
@@ -3642,7 +3646,7 @@ function _findMatch(versionSpec, stable, candidates, archFilter) {
36423646
return chk;
36433647
});
36443648
if (file) {
3645-
core_1.debug(`matched ${candidate.version}`);
3649+
(0, core_1.debug)(`matched ${candidate.version}`);
36463650
match = candidate;
36473651
break;
36483652
}
@@ -3680,10 +3684,7 @@ function _getOsVersion() {
36803684
if (parts.length === 2 &&
36813685
(parts[0].trim() === 'VERSION_ID' ||
36823686
parts[0].trim() === 'DISTRIB_RELEASE')) {
3683-
version = parts[1]
3684-
.trim()
3685-
.replace(/^"/, '')
3686-
.replace(/"$/, '');
3687+
version = parts[1].trim().replace(/^"/, '').replace(/"$/, '');
36873688
break;
36883689
}
36893690
}
@@ -3716,7 +3717,11 @@ exports._readLinuxVersionFile = _readLinuxVersionFile;
37163717

37173718
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
37183719
if (k2 === undefined) k2 = k;
3719-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3720+
var desc = Object.getOwnPropertyDescriptor(m, k);
3721+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3722+
desc = { enumerable: true, get: function() { return m[k]; } };
3723+
}
3724+
Object.defineProperty(o, k2, desc);
37203725
}) : (function(o, m, k, k2) {
37213726
if (k2 === undefined) k2 = k;
37223727
o[k2] = m[k];
@@ -3729,7 +3734,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
37293734
var __importStar = (this && this.__importStar) || function (mod) {
37303735
if (mod && mod.__esModule) return mod;
37313736
var result = {};
3732-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3737+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37333738
__setModuleDefault(result, mod);
37343739
return result;
37353740
};
@@ -3806,7 +3811,11 @@ exports.RetryHelper = RetryHelper;
38063811

38073812
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
38083813
if (k2 === undefined) k2 = k;
3809-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3814+
var desc = Object.getOwnPropertyDescriptor(m, k);
3815+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3816+
desc = { enumerable: true, get: function() { return m[k]; } };
3817+
}
3818+
Object.defineProperty(o, k2, desc);
38103819
}) : (function(o, m, k, k2) {
38113820
if (k2 === undefined) k2 = k;
38123821
o[k2] = m[k];
@@ -3819,7 +3828,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
38193828
var __importStar = (this && this.__importStar) || function (mod) {
38203829
if (mod && mod.__esModule) return mod;
38213830
var result = {};
3822-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3831+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
38233832
__setModuleDefault(result, mod);
38243833
return result;
38253834
};
@@ -3832,13 +3841,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
38323841
step((generator = generator.apply(thisArg, _arguments || [])).next());
38333842
});
38343843
};
3835-
var __importDefault = (this && this.__importDefault) || function (mod) {
3836-
return (mod && mod.__esModule) ? mod : { "default": mod };
3837-
};
38383844
Object.defineProperty(exports, "__esModule", ({ value: true }));
38393845
exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0;
38403846
const core = __importStar(__nccwpck_require__(7484));
38413847
const io = __importStar(__nccwpck_require__(4994));
3848+
const crypto = __importStar(__nccwpck_require__(6982));
38423849
const fs = __importStar(__nccwpck_require__(9896));
38433850
const mm = __importStar(__nccwpck_require__(8036));
38443851
const os = __importStar(__nccwpck_require__(857));
@@ -3848,7 +3855,6 @@ const semver = __importStar(__nccwpck_require__(6193));
38483855
const stream = __importStar(__nccwpck_require__(2203));
38493856
const util = __importStar(__nccwpck_require__(9023));
38503857
const assert_1 = __nccwpck_require__(2613);
3851-
const v4_1 = __importDefault(__nccwpck_require__(9021));
38523858
const exec_1 = __nccwpck_require__(5236);
38533859
const retry_helper_1 = __nccwpck_require__(7380);
38543860
class HTTPError extends Error {
@@ -3873,7 +3879,7 @@ const userAgent = 'actions/tool-cache';
38733879
*/
38743880
function downloadTool(url, dest, auth, headers) {
38753881
return __awaiter(this, void 0, void 0, function* () {
3876-
dest = dest || path.join(_getTempDirectory(), v4_1.default());
3882+
dest = dest || path.join(_getTempDirectory(), crypto.randomUUID());
38773883
yield io.mkdirP(path.dirname(dest));
38783884
core.debug(`Downloading ${url}`);
38793885
core.debug(`Destination ${dest}`);
@@ -3962,8 +3968,8 @@ function downloadToolAttempt(url, dest, auth, headers) {
39623968
*/
39633969
function extract7z(file, dest, _7zPath) {
39643970
return __awaiter(this, void 0, void 0, function* () {
3965-
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
3966-
assert_1.ok(file, 'parameter "file" is required');
3971+
(0, assert_1.ok)(IS_WINDOWS, 'extract7z() not supported on current OS');
3972+
(0, assert_1.ok)(file, 'parameter "file" is required');
39673973
dest = yield _createExtractFolder(dest);
39683974
const originalCwd = process.cwd();
39693975
process.chdir(dest);
@@ -3980,7 +3986,7 @@ function extract7z(file, dest, _7zPath) {
39803986
const options = {
39813987
silent: true
39823988
};
3983-
yield exec_1.exec(`"${_7zPath}"`, args, options);
3989+
yield (0, exec_1.exec)(`"${_7zPath}"`, args, options);
39843990
}
39853991
finally {
39863992
process.chdir(originalCwd);
@@ -4009,7 +4015,7 @@ function extract7z(file, dest, _7zPath) {
40094015
};
40104016
try {
40114017
const powershellPath = yield io.which('powershell', true);
4012-
yield exec_1.exec(`"${powershellPath}"`, args, options);
4018+
yield (0, exec_1.exec)(`"${powershellPath}"`, args, options);
40134019
}
40144020
finally {
40154021
process.chdir(originalCwd);
@@ -4037,7 +4043,7 @@ function extractTar(file, dest, flags = 'xz') {
40374043
// Determine whether GNU tar
40384044
core.debug('Checking tar --version');
40394045
let versionOutput = '';
4040-
yield exec_1.exec('tar --version', [], {
4046+
yield (0, exec_1.exec)('tar --version', [], {
40414047
ignoreReturnCode: true,
40424048
silent: true,
40434049
listeners: {
@@ -4073,7 +4079,7 @@ function extractTar(file, dest, flags = 'xz') {
40734079
args.push('--overwrite');
40744080
}
40754081
args.push('-C', destArg, '-f', fileArg);
4076-
yield exec_1.exec(`tar`, args);
4082+
yield (0, exec_1.exec)(`tar`, args);
40774083
return dest;
40784084
});
40794085
}
@@ -4088,8 +4094,8 @@ exports.extractTar = extractTar;
40884094
*/
40894095
function extractXar(file, dest, flags = []) {
40904096
return __awaiter(this, void 0, void 0, function* () {
4091-
assert_1.ok(IS_MAC, 'extractXar() not supported on current OS');
4092-
assert_1.ok(file, 'parameter "file" is required');
4097+
(0, assert_1.ok)(IS_MAC, 'extractXar() not supported on current OS');
4098+
(0, assert_1.ok)(file, 'parameter "file" is required');
40934099
dest = yield _createExtractFolder(dest);
40944100
let args;
40954101
if (flags instanceof Array) {
@@ -4103,7 +4109,7 @@ function extractXar(file, dest, flags = []) {
41034109
args.push('-v');
41044110
}
41054111
const xarPath = yield io.which('xar', true);
4106-
yield exec_1.exec(`"${xarPath}"`, _unique(args));
4112+
yield (0, exec_1.exec)(`"${xarPath}"`, _unique(args));
41074113
return dest;
41084114
});
41094115
}
@@ -4157,7 +4163,7 @@ function extractZipWin(file, dest) {
41574163
pwshCommand
41584164
];
41594165
core.debug(`Using pwsh at path: ${pwshPath}`);
4160-
yield exec_1.exec(`"${pwshPath}"`, args);
4166+
yield (0, exec_1.exec)(`"${pwshPath}"`, args);
41614167
}
41624168
else {
41634169
const powershellCommand = [
@@ -4178,7 +4184,7 @@ function extractZipWin(file, dest) {
41784184
];
41794185
const powershellPath = yield io.which('powershell', true);
41804186
core.debug(`Using powershell at path: ${powershellPath}`);
4181-
yield exec_1.exec(`"${powershellPath}"`, args);
4187+
yield (0, exec_1.exec)(`"${powershellPath}"`, args);
41824188
}
41834189
});
41844190
}
@@ -4190,7 +4196,7 @@ function extractZipNix(file, dest) {
41904196
args.unshift('-q');
41914197
}
41924198
args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run
4193-
yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
4199+
yield (0, exec_1.exec)(`"${unzipPath}"`, args, { cwd: dest });
41944200
});
41954201
}
41964202
/**
@@ -4367,7 +4373,7 @@ function _createExtractFolder(dest) {
43674373
return __awaiter(this, void 0, void 0, function* () {
43684374
if (!dest) {
43694375
// create a temp dir
4370-
dest = path.join(_getTempDirectory(), v4_1.default());
4376+
dest = path.join(_getTempDirectory(), crypto.randomUUID());
43714377
}
43724378
yield io.mkdirP(dest);
43734379
return dest;
@@ -4440,15 +4446,15 @@ exports.evaluateVersions = evaluateVersions;
44404446
*/
44414447
function _getCacheDirectory() {
44424448
const cacheDirectory = process.env['RUNNER_TOOL_CACHE'] || '';
4443-
assert_1.ok(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined');
4449+
(0, assert_1.ok)(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined');
44444450
return cacheDirectory;
44454451
}
44464452
/**
44474453
* Gets RUNNER_TEMP
44484454
*/
44494455
function _getTempDirectory() {
44504456
const tempDirectory = process.env['RUNNER_TEMP'] || '';
4451-
assert_1.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
4457+
(0, assert_1.ok)(tempDirectory, 'Expected RUNNER_TEMP to be defined');
44524458
return tempDirectory;
44534459
}
44544460
/**
@@ -32483,90 +32489,6 @@ module.exports = {
3248332489
}
3248432490

3248532491

32486-
/***/ }),
32487-
32488-
/***/ 8682:
32489-
/***/ ((module) => {
32490-
32491-
/**
32492-
* Convert array of 16 byte values to UUID string format of the form:
32493-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
32494-
*/
32495-
var byteToHex = [];
32496-
for (var i = 0; i < 256; ++i) {
32497-
byteToHex[i] = (i + 0x100).toString(16).substr(1);
32498-
}
32499-
32500-
function bytesToUuid(buf, offset) {
32501-
var i = offset || 0;
32502-
var bth = byteToHex;
32503-
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
32504-
return ([
32505-
bth[buf[i++]], bth[buf[i++]],
32506-
bth[buf[i++]], bth[buf[i++]], '-',
32507-
bth[buf[i++]], bth[buf[i++]], '-',
32508-
bth[buf[i++]], bth[buf[i++]], '-',
32509-
bth[buf[i++]], bth[buf[i++]], '-',
32510-
bth[buf[i++]], bth[buf[i++]],
32511-
bth[buf[i++]], bth[buf[i++]],
32512-
bth[buf[i++]], bth[buf[i++]]
32513-
]).join('');
32514-
}
32515-
32516-
module.exports = bytesToUuid;
32517-
32518-
32519-
/***/ }),
32520-
32521-
/***/ 1694:
32522-
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
32523-
32524-
// Unique ID creation requires a high quality random # generator. In node.js
32525-
// this is pretty straight-forward - we use the crypto API.
32526-
32527-
var crypto = __nccwpck_require__(6982);
32528-
32529-
module.exports = function nodeRNG() {
32530-
return crypto.randomBytes(16);
32531-
};
32532-
32533-
32534-
/***/ }),
32535-
32536-
/***/ 9021:
32537-
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
32538-
32539-
var rng = __nccwpck_require__(1694);
32540-
var bytesToUuid = __nccwpck_require__(8682);
32541-
32542-
function v4(options, buf, offset) {
32543-
var i = buf && offset || 0;
32544-
32545-
if (typeof(options) == 'string') {
32546-
buf = options === 'binary' ? new Array(16) : null;
32547-
options = null;
32548-
}
32549-
options = options || {};
32550-
32551-
var rnds = options.random || (options.rng || rng)();
32552-
32553-
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
32554-
rnds[6] = (rnds[6] & 0x0f) | 0x40;
32555-
rnds[8] = (rnds[8] & 0x3f) | 0x80;
32556-
32557-
// Copy bytes to buffer, if provided
32558-
if (buf) {
32559-
for (var ii = 0; ii < 16; ++ii) {
32560-
buf[i + ii] = rnds[ii];
32561-
}
32562-
}
32563-
32564-
return buf || bytesToUuid(rnds);
32565-
}
32566-
32567-
module.exports = v4;
32568-
32569-
3257032492
/***/ }),
3257132493

3257232494
/***/ 2613:

0 commit comments

Comments
 (0)