Skip to content

Commit 099ed48

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 50ad9f9 commit 099ed48

File tree

1 file changed

+39
-115
lines changed

1 file changed

+39
-115
lines changed

dist/index.js

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

34273427
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
34283428
if (k2 === undefined) k2 = k;
3429-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3429+
var desc = Object.getOwnPropertyDescriptor(m, k);
3430+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3431+
desc = { enumerable: true, get: function() { return m[k]; } };
3432+
}
3433+
Object.defineProperty(o, k2, desc);
34303434
}) : (function(o, m, k, k2) {
34313435
if (k2 === undefined) k2 = k;
34323436
o[k2] = m[k];
@@ -3439,7 +3443,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
34393443
var __importStar = (this && this.__importStar) || function (mod) {
34403444
if (mod && mod.__esModule) return mod;
34413445
var result = {};
3442-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3446+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
34433447
__setModuleDefault(result, mod);
34443448
return result;
34453449
};
@@ -3469,11 +3473,11 @@ function _findMatch(versionSpec, stable, candidates, archFilter) {
34693473
let file;
34703474
for (const candidate of candidates) {
34713475
const version = candidate.version;
3472-
core_1.debug(`check ${version} satisfies ${versionSpec}`);
3476+
(0, core_1.debug)(`check ${version} satisfies ${versionSpec}`);
34733477
if (semver.satisfies(version, versionSpec) &&
34743478
(!stable || candidate.stable === stable)) {
34753479
file = candidate.files.find(item => {
3476-
core_1.debug(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`);
3480+
(0, core_1.debug)(`${item.arch}===${archFilter} && ${item.platform}===${platFilter}`);
34773481
let chk = item.arch === archFilter && item.platform === platFilter;
34783482
if (chk && item.platform_version) {
34793483
const osVersion = module.exports._getOsVersion();
@@ -3487,7 +3491,7 @@ function _findMatch(versionSpec, stable, candidates, archFilter) {
34873491
return chk;
34883492
});
34893493
if (file) {
3490-
core_1.debug(`matched ${candidate.version}`);
3494+
(0, core_1.debug)(`matched ${candidate.version}`);
34913495
match = candidate;
34923496
break;
34933497
}
@@ -3525,10 +3529,7 @@ function _getOsVersion() {
35253529
if (parts.length === 2 &&
35263530
(parts[0].trim() === 'VERSION_ID' ||
35273531
parts[0].trim() === 'DISTRIB_RELEASE')) {
3528-
version = parts[1]
3529-
.trim()
3530-
.replace(/^"/, '')
3531-
.replace(/"$/, '');
3532+
version = parts[1].trim().replace(/^"/, '').replace(/"$/, '');
35323533
break;
35333534
}
35343535
}
@@ -3561,7 +3562,11 @@ exports._readLinuxVersionFile = _readLinuxVersionFile;
35613562

35623563
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
35633564
if (k2 === undefined) k2 = k;
3564-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3565+
var desc = Object.getOwnPropertyDescriptor(m, k);
3566+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3567+
desc = { enumerable: true, get: function() { return m[k]; } };
3568+
}
3569+
Object.defineProperty(o, k2, desc);
35653570
}) : (function(o, m, k, k2) {
35663571
if (k2 === undefined) k2 = k;
35673572
o[k2] = m[k];
@@ -3574,7 +3579,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
35743579
var __importStar = (this && this.__importStar) || function (mod) {
35753580
if (mod && mod.__esModule) return mod;
35763581
var result = {};
3577-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3582+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
35783583
__setModuleDefault(result, mod);
35793584
return result;
35803585
};
@@ -3651,7 +3656,11 @@ exports.RetryHelper = RetryHelper;
36513656

36523657
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
36533658
if (k2 === undefined) k2 = k;
3654-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3659+
var desc = Object.getOwnPropertyDescriptor(m, k);
3660+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3661+
desc = { enumerable: true, get: function() { return m[k]; } };
3662+
}
3663+
Object.defineProperty(o, k2, desc);
36553664
}) : (function(o, m, k, k2) {
36563665
if (k2 === undefined) k2 = k;
36573666
o[k2] = m[k];
@@ -3664,7 +3673,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
36643673
var __importStar = (this && this.__importStar) || function (mod) {
36653674
if (mod && mod.__esModule) return mod;
36663675
var result = {};
3667-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
3676+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36683677
__setModuleDefault(result, mod);
36693678
return result;
36703679
};
@@ -3677,13 +3686,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
36773686
step((generator = generator.apply(thisArg, _arguments || [])).next());
36783687
});
36793688
};
3680-
var __importDefault = (this && this.__importDefault) || function (mod) {
3681-
return (mod && mod.__esModule) ? mod : { "default": mod };
3682-
};
36833689
Object.defineProperty(exports, "__esModule", ({ value: true }));
36843690
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;
36853691
const core = __importStar(__nccwpck_require__(7484));
36863692
const io = __importStar(__nccwpck_require__(4994));
3693+
const crypto = __importStar(__nccwpck_require__(6982));
36873694
const fs = __importStar(__nccwpck_require__(9896));
36883695
const mm = __importStar(__nccwpck_require__(8036));
36893696
const os = __importStar(__nccwpck_require__(857));
@@ -3693,7 +3700,6 @@ const semver = __importStar(__nccwpck_require__(6193));
36933700
const stream = __importStar(__nccwpck_require__(2203));
36943701
const util = __importStar(__nccwpck_require__(9023));
36953702
const assert_1 = __nccwpck_require__(2613);
3696-
const v4_1 = __importDefault(__nccwpck_require__(9021));
36973703
const exec_1 = __nccwpck_require__(5236);
36983704
const retry_helper_1 = __nccwpck_require__(7380);
36993705
class HTTPError extends Error {
@@ -3718,7 +3724,7 @@ const userAgent = 'actions/tool-cache';
37183724
*/
37193725
function downloadTool(url, dest, auth, headers) {
37203726
return __awaiter(this, void 0, void 0, function* () {
3721-
dest = dest || path.join(_getTempDirectory(), v4_1.default());
3727+
dest = dest || path.join(_getTempDirectory(), crypto.randomUUID());
37223728
yield io.mkdirP(path.dirname(dest));
37233729
core.debug(`Downloading ${url}`);
37243730
core.debug(`Destination ${dest}`);
@@ -3807,8 +3813,8 @@ function downloadToolAttempt(url, dest, auth, headers) {
38073813
*/
38083814
function extract7z(file, dest, _7zPath) {
38093815
return __awaiter(this, void 0, void 0, function* () {
3810-
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
3811-
assert_1.ok(file, 'parameter "file" is required');
3816+
(0, assert_1.ok)(IS_WINDOWS, 'extract7z() not supported on current OS');
3817+
(0, assert_1.ok)(file, 'parameter "file" is required');
38123818
dest = yield _createExtractFolder(dest);
38133819
const originalCwd = process.cwd();
38143820
process.chdir(dest);
@@ -3825,7 +3831,7 @@ function extract7z(file, dest, _7zPath) {
38253831
const options = {
38263832
silent: true
38273833
};
3828-
yield exec_1.exec(`"${_7zPath}"`, args, options);
3834+
yield (0, exec_1.exec)(`"${_7zPath}"`, args, options);
38293835
}
38303836
finally {
38313837
process.chdir(originalCwd);
@@ -3854,7 +3860,7 @@ function extract7z(file, dest, _7zPath) {
38543860
};
38553861
try {
38563862
const powershellPath = yield io.which('powershell', true);
3857-
yield exec_1.exec(`"${powershellPath}"`, args, options);
3863+
yield (0, exec_1.exec)(`"${powershellPath}"`, args, options);
38583864
}
38593865
finally {
38603866
process.chdir(originalCwd);
@@ -3882,7 +3888,7 @@ function extractTar(file, dest, flags = 'xz') {
38823888
// Determine whether GNU tar
38833889
core.debug('Checking tar --version');
38843890
let versionOutput = '';
3885-
yield exec_1.exec('tar --version', [], {
3891+
yield (0, exec_1.exec)('tar --version', [], {
38863892
ignoreReturnCode: true,
38873893
silent: true,
38883894
listeners: {
@@ -3918,7 +3924,7 @@ function extractTar(file, dest, flags = 'xz') {
39183924
args.push('--overwrite');
39193925
}
39203926
args.push('-C', destArg, '-f', fileArg);
3921-
yield exec_1.exec(`tar`, args);
3927+
yield (0, exec_1.exec)(`tar`, args);
39223928
return dest;
39233929
});
39243930
}
@@ -3933,8 +3939,8 @@ exports.extractTar = extractTar;
39333939
*/
39343940
function extractXar(file, dest, flags = []) {
39353941
return __awaiter(this, void 0, void 0, function* () {
3936-
assert_1.ok(IS_MAC, 'extractXar() not supported on current OS');
3937-
assert_1.ok(file, 'parameter "file" is required');
3942+
(0, assert_1.ok)(IS_MAC, 'extractXar() not supported on current OS');
3943+
(0, assert_1.ok)(file, 'parameter "file" is required');
39383944
dest = yield _createExtractFolder(dest);
39393945
let args;
39403946
if (flags instanceof Array) {
@@ -3948,7 +3954,7 @@ function extractXar(file, dest, flags = []) {
39483954
args.push('-v');
39493955
}
39503956
const xarPath = yield io.which('xar', true);
3951-
yield exec_1.exec(`"${xarPath}"`, _unique(args));
3957+
yield (0, exec_1.exec)(`"${xarPath}"`, _unique(args));
39523958
return dest;
39533959
});
39543960
}
@@ -4002,7 +4008,7 @@ function extractZipWin(file, dest) {
40024008
pwshCommand
40034009
];
40044010
core.debug(`Using pwsh at path: ${pwshPath}`);
4005-
yield exec_1.exec(`"${pwshPath}"`, args);
4011+
yield (0, exec_1.exec)(`"${pwshPath}"`, args);
40064012
}
40074013
else {
40084014
const powershellCommand = [
@@ -4023,7 +4029,7 @@ function extractZipWin(file, dest) {
40234029
];
40244030
const powershellPath = yield io.which('powershell', true);
40254031
core.debug(`Using powershell at path: ${powershellPath}`);
4026-
yield exec_1.exec(`"${powershellPath}"`, args);
4032+
yield (0, exec_1.exec)(`"${powershellPath}"`, args);
40274033
}
40284034
});
40294035
}
@@ -4035,7 +4041,7 @@ function extractZipNix(file, dest) {
40354041
args.unshift('-q');
40364042
}
40374043
args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run
4038-
yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
4044+
yield (0, exec_1.exec)(`"${unzipPath}"`, args, { cwd: dest });
40394045
});
40404046
}
40414047
/**
@@ -4212,7 +4218,7 @@ function _createExtractFolder(dest) {
42124218
return __awaiter(this, void 0, void 0, function* () {
42134219
if (!dest) {
42144220
// create a temp dir
4215-
dest = path.join(_getTempDirectory(), v4_1.default());
4221+
dest = path.join(_getTempDirectory(), crypto.randomUUID());
42164222
}
42174223
yield io.mkdirP(dest);
42184224
return dest;
@@ -4285,15 +4291,15 @@ exports.evaluateVersions = evaluateVersions;
42854291
*/
42864292
function _getCacheDirectory() {
42874293
const cacheDirectory = process.env['RUNNER_TOOL_CACHE'] || '';
4288-
assert_1.ok(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined');
4294+
(0, assert_1.ok)(cacheDirectory, 'Expected RUNNER_TOOL_CACHE to be defined');
42894295
return cacheDirectory;
42904296
}
42914297
/**
42924298
* Gets RUNNER_TEMP
42934299
*/
42944300
function _getTempDirectory() {
42954301
const tempDirectory = process.env['RUNNER_TEMP'] || '';
4296-
assert_1.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined');
4302+
(0, assert_1.ok)(tempDirectory, 'Expected RUNNER_TEMP to be defined');
42974303
return tempDirectory;
42984304
}
42994305
/**
@@ -12167,88 +12173,6 @@ function obtainContentCharset(response) {
1216712173
}
1216812174

1216912175

12170-
/***/ }),
12171-
12172-
/***/ 8682:
12173-
/***/ ((module) => {
12174-
12175-
/**
12176-
* Convert array of 16 byte values to UUID string format of the form:
12177-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
12178-
*/
12179-
var byteToHex = [];
12180-
for (var i = 0; i < 256; ++i) {
12181-
byteToHex[i] = (i + 0x100).toString(16).substr(1);
12182-
}
12183-
12184-
function bytesToUuid(buf, offset) {
12185-
var i = offset || 0;
12186-
var bth = byteToHex;
12187-
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
12188-
return ([bth[buf[i++]], bth[buf[i++]],
12189-
bth[buf[i++]], bth[buf[i++]], '-',
12190-
bth[buf[i++]], bth[buf[i++]], '-',
12191-
bth[buf[i++]], bth[buf[i++]], '-',
12192-
bth[buf[i++]], bth[buf[i++]], '-',
12193-
bth[buf[i++]], bth[buf[i++]],
12194-
bth[buf[i++]], bth[buf[i++]],
12195-
bth[buf[i++]], bth[buf[i++]]]).join('');
12196-
}
12197-
12198-
module.exports = bytesToUuid;
12199-
12200-
12201-
/***/ }),
12202-
12203-
/***/ 1694:
12204-
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
12205-
12206-
// Unique ID creation requires a high quality random # generator. In node.js
12207-
// this is pretty straight-forward - we use the crypto API.
12208-
12209-
var crypto = __nccwpck_require__(6982);
12210-
12211-
module.exports = function nodeRNG() {
12212-
return crypto.randomBytes(16);
12213-
};
12214-
12215-
12216-
/***/ }),
12217-
12218-
/***/ 9021:
12219-
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
12220-
12221-
var rng = __nccwpck_require__(1694);
12222-
var bytesToUuid = __nccwpck_require__(8682);
12223-
12224-
function v4(options, buf, offset) {
12225-
var i = buf && offset || 0;
12226-
12227-
if (typeof(options) == 'string') {
12228-
buf = options === 'binary' ? new Array(16) : null;
12229-
options = null;
12230-
}
12231-
options = options || {};
12232-
12233-
var rnds = options.random || (options.rng || rng)();
12234-
12235-
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
12236-
rnds[6] = (rnds[6] & 0x0f) | 0x40;
12237-
rnds[8] = (rnds[8] & 0x3f) | 0x80;
12238-
12239-
// Copy bytes to buffer, if provided
12240-
if (buf) {
12241-
for (var ii = 0; ii < 16; ++ii) {
12242-
buf[i + ii] = rnds[ii];
12243-
}
12244-
}
12245-
12246-
return buf || bytesToUuid(rnds);
12247-
}
12248-
12249-
module.exports = v4;
12250-
12251-
1225212176
/***/ }),
1225312177

1225412178
/***/ 2613:

0 commit comments

Comments
 (0)