Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit 1b9ee16

Browse files
committed
bump version
1 parent dc44171 commit 1b9ee16

File tree

3 files changed

+197
-45
lines changed

3 files changed

+197
-45
lines changed

dist/index.js

Lines changed: 195 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,32 @@ const windowsRelease = release => {
771771
module.exports = windowsRelease;
772772

773773

774+
/***/ }),
775+
776+
/***/ 82:
777+
/***/ (function(__unusedmodule, exports) {
778+
779+
"use strict";
780+
781+
// We use any as a valid input type
782+
/* eslint-disable @typescript-eslint/no-explicit-any */
783+
Object.defineProperty(exports, "__esModule", { value: true });
784+
/**
785+
* Sanitizes an input into a string so it can be passed into issueCommand safely
786+
* @param input input to sanitize into a string
787+
*/
788+
function toCommandValue(input) {
789+
if (input === null || input === undefined) {
790+
return '';
791+
}
792+
else if (typeof input === 'string' || input instanceof String) {
793+
return input;
794+
}
795+
return JSON.stringify(input);
796+
}
797+
exports.toCommandValue = toCommandValue;
798+
//# sourceMappingURL=utils.js.map
799+
774800
/***/ }),
775801

776802
/***/ 87:
@@ -780,6 +806,42 @@ module.exports = require("os");
780806

781807
/***/ }),
782808

809+
/***/ 102:
810+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
811+
812+
"use strict";
813+
814+
// For internal use, subject to change.
815+
var __importStar = (this && this.__importStar) || function (mod) {
816+
if (mod && mod.__esModule) return mod;
817+
var result = {};
818+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
819+
result["default"] = mod;
820+
return result;
821+
};
822+
Object.defineProperty(exports, "__esModule", { value: true });
823+
// We use any as a valid input type
824+
/* eslint-disable @typescript-eslint/no-explicit-any */
825+
const fs = __importStar(__webpack_require__(747));
826+
const os = __importStar(__webpack_require__(87));
827+
const utils_1 = __webpack_require__(82);
828+
function issueCommand(command, message) {
829+
const filePath = process.env[`GITHUB_${command}`];
830+
if (!filePath) {
831+
throw new Error(`Unable to find environment variable for file command ${command}`);
832+
}
833+
if (!fs.existsSync(filePath)) {
834+
throw new Error(`Missing file at path: ${filePath}`);
835+
}
836+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
837+
encoding: 'utf8'
838+
});
839+
}
840+
exports.issueCommand = issueCommand;
841+
//# sourceMappingURL=file-command.js.map
842+
843+
/***/ }),
844+
783845
/***/ 118:
784846
/***/ (function(module, __unusedexports, __webpack_require__) {
785847

@@ -4834,17 +4896,25 @@ function octokitValidate (octokit) {
48344896

48354897
"use strict";
48364898

4899+
var __importStar = (this && this.__importStar) || function (mod) {
4900+
if (mod && mod.__esModule) return mod;
4901+
var result = {};
4902+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
4903+
result["default"] = mod;
4904+
return result;
4905+
};
48374906
Object.defineProperty(exports, "__esModule", { value: true });
4838-
const os = __webpack_require__(87);
4907+
const os = __importStar(__webpack_require__(87));
4908+
const utils_1 = __webpack_require__(82);
48394909
/**
48404910
* Commands
48414911
*
48424912
* Command Format:
4843-
* ##[name key=value;key=value]message
4913+
* ::name key=value,key=value::message
48444914
*
48454915
* Examples:
4846-
* ##[warning]This is the user warning message
4847-
* ##[set-secret name=mypassword]definitelyNotAPassword!
4916+
* ::warning::This is the message
4917+
* ::set-env name=MY_VAR::some value
48484918
*/
48494919
function issueCommand(command, properties, message) {
48504920
const cmd = new Command(command, properties, message);
@@ -4855,7 +4925,7 @@ function issue(name, message = '') {
48554925
issueCommand(name, {}, message);
48564926
}
48574927
exports.issue = issue;
4858-
const CMD_PREFIX = '##[';
4928+
const CMD_STRING = '::';
48594929
class Command {
48604930
constructor(command, properties, message) {
48614931
if (!command) {
@@ -4866,37 +4936,42 @@ class Command {
48664936
this.message = message;
48674937
}
48684938
toString() {
4869-
let cmdStr = CMD_PREFIX + this.command;
4939+
let cmdStr = CMD_STRING + this.command;
48704940
if (this.properties && Object.keys(this.properties).length > 0) {
48714941
cmdStr += ' ';
4942+
let first = true;
48724943
for (const key in this.properties) {
48734944
if (this.properties.hasOwnProperty(key)) {
48744945
const val = this.properties[key];
48754946
if (val) {
4876-
// safely append the val - avoid blowing up when attempting to
4877-
// call .replace() if message is not a string for some reason
4878-
cmdStr += `${key}=${escape(`${val || ''}`)};`;
4947+
if (first) {
4948+
first = false;
4949+
}
4950+
else {
4951+
cmdStr += ',';
4952+
}
4953+
cmdStr += `${key}=${escapeProperty(val)}`;
48794954
}
48804955
}
48814956
}
48824957
}
4883-
cmdStr += ']';
4884-
// safely append the message - avoid blowing up when attempting to
4885-
// call .replace() if message is not a string for some reason
4886-
const message = `${this.message || ''}`;
4887-
cmdStr += escapeData(message);
4958+
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
48884959
return cmdStr;
48894960
}
48904961
}
48914962
function escapeData(s) {
4892-
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
4963+
return utils_1.toCommandValue(s)
4964+
.replace(/%/g, '%25')
4965+
.replace(/\r/g, '%0D')
4966+
.replace(/\n/g, '%0A');
48934967
}
4894-
function escape(s) {
4895-
return s
4968+
function escapeProperty(s) {
4969+
return utils_1.toCommandValue(s)
4970+
.replace(/%/g, '%25')
48964971
.replace(/\r/g, '%0D')
48974972
.replace(/\n/g, '%0A')
4898-
.replace(/]/g, '%5D')
4899-
.replace(/;/g, '%3B');
4973+
.replace(/:/g, '%3A')
4974+
.replace(/,/g, '%2C');
49004975
}
49014976
//# sourceMappingURL=command.js.map
49024977

@@ -5462,6 +5537,12 @@ function convertBody(buffer, headers) {
54625537
// html4
54635538
if (!res && str) {
54645539
res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
5540+
if (!res) {
5541+
res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str);
5542+
if (res) {
5543+
res.pop(); // drop last quote
5544+
}
5545+
}
54655546

54665547
if (res) {
54675548
res = /charset=(.*)/i.exec(res.pop());
@@ -6469,7 +6550,7 @@ function fetch(url, opts) {
64696550
// HTTP fetch step 5.5
64706551
switch (request.redirect) {
64716552
case 'error':
6472-
reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect'));
6553+
reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));
64736554
finalize();
64746555
return;
64756556
case 'manual':
@@ -6508,7 +6589,8 @@ function fetch(url, opts) {
65086589
method: request.method,
65096590
body: request.body,
65106591
signal: request.signal,
6511-
timeout: request.timeout
6592+
timeout: request.timeout,
6593+
size: request.size
65126594
};
65136595

65146596
// HTTP-redirect fetch step 9
@@ -6770,9 +6852,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
67706852
step((generator = generator.apply(thisArg, _arguments || [])).next());
67716853
});
67726854
};
6855+
var __importStar = (this && this.__importStar) || function (mod) {
6856+
if (mod && mod.__esModule) return mod;
6857+
var result = {};
6858+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6859+
result["default"] = mod;
6860+
return result;
6861+
};
67736862
Object.defineProperty(exports, "__esModule", { value: true });
67746863
const command_1 = __webpack_require__(431);
6775-
const path = __webpack_require__(622);
6864+
const file_command_1 = __webpack_require__(102);
6865+
const utils_1 = __webpack_require__(82);
6866+
const os = __importStar(__webpack_require__(87));
6867+
const path = __importStar(__webpack_require__(622));
67766868
/**
67776869
* The code to exit an action
67786870
*/
@@ -6791,34 +6883,45 @@ var ExitCode;
67916883
// Variables
67926884
//-----------------------------------------------------------------------
67936885
/**
6794-
* sets env variable for this action and future actions in the job
6886+
* Sets env variable for this action and future actions in the job
67956887
* @param name the name of the variable to set
6796-
* @param val the value of the variable
6888+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
67976889
*/
6890+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
67986891
function exportVariable(name, val) {
6799-
process.env[name] = val;
6800-
command_1.issueCommand('set-env', { name }, val);
6892+
const convertedVal = utils_1.toCommandValue(val);
6893+
process.env[name] = convertedVal;
6894+
const filePath = process.env['GITHUB_ENV'] || '';
6895+
if (filePath) {
6896+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
6897+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
6898+
file_command_1.issueCommand('ENV', commandValue);
6899+
}
6900+
else {
6901+
command_1.issueCommand('set-env', { name }, convertedVal);
6902+
}
68016903
}
68026904
exports.exportVariable = exportVariable;
68036905
/**
6804-
* exports the variable and registers a secret which will get masked from logs
6805-
* @param name the name of the variable to set
6806-
* @param val value of the secret
6906+
* Registers a secret which will get masked from logs
6907+
* @param secret value of the secret
68076908
*/
6808-
function exportSecret(name, val) {
6809-
exportVariable(name, val);
6810-
// the runner will error with not implemented
6811-
// leaving the function but raising the error earlier
6812-
command_1.issueCommand('set-secret', {}, val);
6813-
throw new Error('Not implemented.');
6909+
function setSecret(secret) {
6910+
command_1.issueCommand('add-mask', {}, secret);
68146911
}
6815-
exports.exportSecret = exportSecret;
6912+
exports.setSecret = setSecret;
68166913
/**
68176914
* Prepends inputPath to the PATH (for this action and future actions)
68186915
* @param inputPath
68196916
*/
68206917
function addPath(inputPath) {
6821-
command_1.issueCommand('add-path', {}, inputPath);
6918+
const filePath = process.env['GITHUB_PATH'] || '';
6919+
if (filePath) {
6920+
file_command_1.issueCommand('PATH', inputPath);
6921+
}
6922+
else {
6923+
command_1.issueCommand('add-path', {}, inputPath);
6924+
}
68226925
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
68236926
}
68246927
exports.addPath = addPath;
@@ -6830,7 +6933,7 @@ exports.addPath = addPath;
68306933
* @returns string
68316934
*/
68326935
function getInput(name, options) {
6833-
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
6936+
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
68346937
if (options && options.required && !val) {
68356938
throw new Error(`Input required and not supplied: ${name}`);
68366939
}
@@ -6841,12 +6944,22 @@ exports.getInput = getInput;
68416944
* Sets the value of an output.
68426945
*
68436946
* @param name name of the output to set
6844-
* @param value value to store
6947+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
68456948
*/
6949+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
68466950
function setOutput(name, value) {
68476951
command_1.issueCommand('set-output', { name }, value);
68486952
}
68496953
exports.setOutput = setOutput;
6954+
/**
6955+
* Enables or disables the echoing of commands into stdout for the rest of the step.
6956+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
6957+
*
6958+
*/
6959+
function setCommandEcho(enabled) {
6960+
command_1.issue('echo', enabled ? 'on' : 'off');
6961+
}
6962+
exports.setCommandEcho = setCommandEcho;
68506963
//-----------------------------------------------------------------------
68516964
// Results
68526965
//-----------------------------------------------------------------------
@@ -6863,6 +6976,13 @@ exports.setFailed = setFailed;
68636976
//-----------------------------------------------------------------------
68646977
// Logging Commands
68656978
//-----------------------------------------------------------------------
6979+
/**
6980+
* Gets whether Actions Step Debug is on or not
6981+
*/
6982+
function isDebug() {
6983+
return process.env['RUNNER_DEBUG'] === '1';
6984+
}
6985+
exports.isDebug = isDebug;
68666986
/**
68676987
* Writes debug message to user log
68686988
* @param message debug message
@@ -6873,20 +6993,28 @@ function debug(message) {
68736993
exports.debug = debug;
68746994
/**
68756995
* Adds an error issue
6876-
* @param message error issue message
6996+
* @param message error issue message. Errors will be converted to string via toString()
68776997
*/
68786998
function error(message) {
6879-
command_1.issue('error', message);
6999+
command_1.issue('error', message instanceof Error ? message.toString() : message);
68807000
}
68817001
exports.error = error;
68827002
/**
68837003
* Adds an warning issue
6884-
* @param message warning issue message
7004+
* @param message warning issue message. Errors will be converted to string via toString()
68857005
*/
68867006
function warning(message) {
6887-
command_1.issue('warning', message);
7007+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
68887008
}
68897009
exports.warning = warning;
7010+
/**
7011+
* Writes info to log with console.log.
7012+
* @param message info message
7013+
*/
7014+
function info(message) {
7015+
process.stdout.write(message + os.EOL);
7016+
}
7017+
exports.info = info;
68907018
/**
68917019
* Begin an output group.
68927020
*
@@ -6927,6 +7055,30 @@ function group(name, fn) {
69277055
});
69287056
}
69297057
exports.group = group;
7058+
//-----------------------------------------------------------------------
7059+
// Wrapper action state
7060+
//-----------------------------------------------------------------------
7061+
/**
7062+
* Saves state for current action, the state can only be retrieved by this action's post job execution.
7063+
*
7064+
* @param name name of the state to store
7065+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
7066+
*/
7067+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7068+
function saveState(name, value) {
7069+
command_1.issueCommand('save-state', { name }, value);
7070+
}
7071+
exports.saveState = saveState;
7072+
/**
7073+
* Gets the value of an state set by this action's main execution.
7074+
*
7075+
* @param name name of the state to get
7076+
* @returns string
7077+
*/
7078+
function getState(name) {
7079+
return process.env[`STATE_${name}`] || '';
7080+
}
7081+
exports.getState = getState;
69307082
//# sourceMappingURL=core.js.map
69317083

69327084
/***/ }),

0 commit comments

Comments
 (0)