Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit eaade8f

Browse files
chore(release): 2.0.6 [skip ci]
## [2.0.6](v2.0.5...v2.0.6) (2020-10-06) ### Bug Fixes * **deps:** bump @actions/core from 1.2.5 to 1.2.6 ([ebf93b5](ebf93b5))
1 parent d85b7d2 commit eaade8f

File tree

2 files changed

+91
-19
lines changed

2 files changed

+91
-19
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [2.0.6](https://github.com/Lundalogik/differential-build-action/compare/v2.0.5...v2.0.6) (2020-10-06)
2+
3+
4+
### Bug Fixes
5+
6+
* **deps:** bump @actions/core from 1.2.5 to 1.2.6 ([ebf93b5](https://github.com/Lundalogik/differential-build-action/commit/ebf93b5e79a9e232a0d02a23ab509c07def2e0a1))
7+
18
## [2.0.5](https://github.com/Lundalogik/differential-build-action/compare/v2.0.4...v2.0.5) (2020-09-14)
29

310

dist/index.js

Lines changed: 84 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
8282
};
8383
Object.defineProperty(exports, "__esModule", ({ value: true }));
8484
const os = __importStar(__webpack_require__(87));
85+
const utils_1 = __webpack_require__(278);
8586
/**
8687
* Commands
8788
*
@@ -135,28 +136,14 @@ class Command {
135136
return cmdStr;
136137
}
137138
}
138-
/**
139-
* Sanitizes an input into a string so it can be passed into issueCommand safely
140-
* @param input input to sanitize into a string
141-
*/
142-
function toCommandValue(input) {
143-
if (input === null || input === undefined) {
144-
return '';
145-
}
146-
else if (typeof input === 'string' || input instanceof String) {
147-
return input;
148-
}
149-
return JSON.stringify(input);
150-
}
151-
exports.toCommandValue = toCommandValue;
152139
function escapeData(s) {
153-
return toCommandValue(s)
140+
return utils_1.toCommandValue(s)
154141
.replace(/%/g, '%25')
155142
.replace(/\r/g, '%0D')
156143
.replace(/\n/g, '%0A');
157144
}
158145
function escapeProperty(s) {
159-
return toCommandValue(s)
146+
return utils_1.toCommandValue(s)
160147
.replace(/%/g, '%25')
161148
.replace(/\r/g, '%0D')
162149
.replace(/\n/g, '%0A')
@@ -190,6 +177,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
190177
};
191178
Object.defineProperty(exports, "__esModule", ({ value: true }));
192179
const command_1 = __webpack_require__(351);
180+
const file_command_1 = __webpack_require__(717);
181+
const utils_1 = __webpack_require__(278);
193182
const os = __importStar(__webpack_require__(87));
194183
const path = __importStar(__webpack_require__(622));
195184
/**
@@ -216,9 +205,17 @@ var ExitCode;
216205
*/
217206
// eslint-disable-next-line @typescript-eslint/no-explicit-any
218207
function exportVariable(name, val) {
219-
const convertedVal = command_1.toCommandValue(val);
208+
const convertedVal = utils_1.toCommandValue(val);
220209
process.env[name] = convertedVal;
221-
command_1.issueCommand('set-env', { name }, convertedVal);
210+
const filePath = process.env['GITHUB_ENV'] || '';
211+
if (filePath) {
212+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
213+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
214+
file_command_1.issueCommand('ENV', commandValue);
215+
}
216+
else {
217+
command_1.issueCommand('set-env', { name }, convertedVal);
218+
}
222219
}
223220
exports.exportVariable = exportVariable;
224221
/**
@@ -234,7 +231,13 @@ exports.setSecret = setSecret;
234231
* @param inputPath
235232
*/
236233
function addPath(inputPath) {
237-
command_1.issueCommand('add-path', {}, inputPath);
234+
const filePath = process.env['GITHUB_PATH'] || '';
235+
if (filePath) {
236+
file_command_1.issueCommand('PATH', inputPath);
237+
}
238+
else {
239+
command_1.issueCommand('add-path', {}, inputPath);
240+
}
238241
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
239242
}
240243
exports.addPath = addPath;
@@ -396,6 +399,68 @@ exports.getState = getState;
396399

397400
/***/ }),
398401

402+
/***/ 717:
403+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
404+
405+
"use strict";
406+
407+
// For internal use, subject to change.
408+
var __importStar = (this && this.__importStar) || function (mod) {
409+
if (mod && mod.__esModule) return mod;
410+
var result = {};
411+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
412+
result["default"] = mod;
413+
return result;
414+
};
415+
Object.defineProperty(exports, "__esModule", ({ value: true }));
416+
// We use any as a valid input type
417+
/* eslint-disable @typescript-eslint/no-explicit-any */
418+
const fs = __importStar(__webpack_require__(747));
419+
const os = __importStar(__webpack_require__(87));
420+
const utils_1 = __webpack_require__(278);
421+
function issueCommand(command, message) {
422+
const filePath = process.env[`GITHUB_${command}`];
423+
if (!filePath) {
424+
throw new Error(`Unable to find environment variable for file command ${command}`);
425+
}
426+
if (!fs.existsSync(filePath)) {
427+
throw new Error(`Missing file at path: ${filePath}`);
428+
}
429+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
430+
encoding: 'utf8'
431+
});
432+
}
433+
exports.issueCommand = issueCommand;
434+
//# sourceMappingURL=file-command.js.map
435+
436+
/***/ }),
437+
438+
/***/ 278:
439+
/***/ ((__unused_webpack_module, exports) => {
440+
441+
"use strict";
442+
443+
// We use any as a valid input type
444+
/* eslint-disable @typescript-eslint/no-explicit-any */
445+
Object.defineProperty(exports, "__esModule", ({ value: true }));
446+
/**
447+
* Sanitizes an input into a string so it can be passed into issueCommand safely
448+
* @param input input to sanitize into a string
449+
*/
450+
function toCommandValue(input) {
451+
if (input === null || input === undefined) {
452+
return '';
453+
}
454+
else if (typeof input === 'string' || input instanceof String) {
455+
return input;
456+
}
457+
return JSON.stringify(input);
458+
}
459+
exports.toCommandValue = toCommandValue;
460+
//# sourceMappingURL=utils.js.map
461+
462+
/***/ }),
463+
399464
/***/ 514:
400465
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
401466

0 commit comments

Comments
 (0)