Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 11be7ef

Browse files
committed
update for 1.1.2
1 parent 20b257c commit 11be7ef

3 files changed

Lines changed: 149 additions & 31 deletions

File tree

dist/index.js

Lines changed: 147 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,6 +1985,32 @@ module.exports = {
19851985
};
19861986

19871987

1988+
/***/ }),
1989+
1990+
/***/ 82:
1991+
/***/ (function(__unusedmodule, exports) {
1992+
1993+
"use strict";
1994+
1995+
// We use any as a valid input type
1996+
/* eslint-disable @typescript-eslint/no-explicit-any */
1997+
Object.defineProperty(exports, "__esModule", { value: true });
1998+
/**
1999+
* Sanitizes an input into a string so it can be passed into issueCommand safely
2000+
* @param input input to sanitize into a string
2001+
*/
2002+
function toCommandValue(input) {
2003+
if (input === null || input === undefined) {
2004+
return '';
2005+
}
2006+
else if (typeof input === 'string' || input instanceof String) {
2007+
return input;
2008+
}
2009+
return JSON.stringify(input);
2010+
}
2011+
exports.toCommandValue = toCommandValue;
2012+
//# sourceMappingURL=utils.js.map
2013+
19882014
/***/ }),
19892015

19902016
/***/ 87:
@@ -1994,6 +2020,42 @@ module.exports = require("os");
19942020

19952021
/***/ }),
19962022

2023+
/***/ 102:
2024+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
2025+
2026+
"use strict";
2027+
2028+
// For internal use, subject to change.
2029+
var __importStar = (this && this.__importStar) || function (mod) {
2030+
if (mod && mod.__esModule) return mod;
2031+
var result = {};
2032+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
2033+
result["default"] = mod;
2034+
return result;
2035+
};
2036+
Object.defineProperty(exports, "__esModule", { value: true });
2037+
// We use any as a valid input type
2038+
/* eslint-disable @typescript-eslint/no-explicit-any */
2039+
const fs = __importStar(__webpack_require__(747));
2040+
const os = __importStar(__webpack_require__(87));
2041+
const utils_1 = __webpack_require__(82);
2042+
function issueCommand(command, message) {
2043+
const filePath = process.env[`GITHUB_${command}`];
2044+
if (!filePath) {
2045+
throw new Error(`Unable to find environment variable for file command ${command}`);
2046+
}
2047+
if (!fs.existsSync(filePath)) {
2048+
throw new Error(`Missing file at path: ${filePath}`);
2049+
}
2050+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
2051+
encoding: 'utf8'
2052+
});
2053+
}
2054+
exports.issueCommand = issueCommand;
2055+
//# sourceMappingURL=file-command.js.map
2056+
2057+
/***/ }),
2058+
19972059
/***/ 118:
19982060
/***/ (function(module, __unusedexports, __webpack_require__) {
19992061

@@ -4562,17 +4624,25 @@ function errname(uv, code) {
45624624

45634625
"use strict";
45644626

4627+
var __importStar = (this && this.__importStar) || function (mod) {
4628+
if (mod && mod.__esModule) return mod;
4629+
var result = {};
4630+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
4631+
result["default"] = mod;
4632+
return result;
4633+
};
45654634
Object.defineProperty(exports, "__esModule", { value: true });
4566-
const os = __webpack_require__(87);
4635+
const os = __importStar(__webpack_require__(87));
4636+
const utils_1 = __webpack_require__(82);
45674637
/**
45684638
* Commands
45694639
*
45704640
* Command Format:
4571-
* ##[name key=value;key=value]message
4641+
* ::name key=value,key=value::message
45724642
*
45734643
* Examples:
4574-
* ##[warning]This is the user warning message
4575-
* ##[set-secret name=mypassword]definitelyNotAPassword!
4644+
* ::warning::This is the message
4645+
* ::set-env name=MY_VAR::some value
45764646
*/
45774647
function issueCommand(command, properties, message) {
45784648
const cmd = new Command(command, properties, message);
@@ -4597,34 +4667,39 @@ class Command {
45974667
let cmdStr = CMD_STRING + this.command;
45984668
if (this.properties && Object.keys(this.properties).length > 0) {
45994669
cmdStr += ' ';
4670+
let first = true;
46004671
for (const key in this.properties) {
46014672
if (this.properties.hasOwnProperty(key)) {
46024673
const val = this.properties[key];
46034674
if (val) {
4604-
// safely append the val - avoid blowing up when attempting to
4605-
// call .replace() if message is not a string for some reason
4606-
cmdStr += `${key}=${escape(`${val || ''}`)},`;
4675+
if (first) {
4676+
first = false;
4677+
}
4678+
else {
4679+
cmdStr += ',';
4680+
}
4681+
cmdStr += `${key}=${escapeProperty(val)}`;
46074682
}
46084683
}
46094684
}
46104685
}
4611-
cmdStr += CMD_STRING;
4612-
// safely append the message - avoid blowing up when attempting to
4613-
// call .replace() if message is not a string for some reason
4614-
const message = `${this.message || ''}`;
4615-
cmdStr += escapeData(message);
4686+
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
46164687
return cmdStr;
46174688
}
46184689
}
46194690
function escapeData(s) {
4620-
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
4691+
return utils_1.toCommandValue(s)
4692+
.replace(/%/g, '%25')
4693+
.replace(/\r/g, '%0D')
4694+
.replace(/\n/g, '%0A');
46214695
}
4622-
function escape(s) {
4623-
return s
4696+
function escapeProperty(s) {
4697+
return utils_1.toCommandValue(s)
4698+
.replace(/%/g, '%25')
46244699
.replace(/\r/g, '%0D')
46254700
.replace(/\n/g, '%0A')
4626-
.replace(/]/g, '%5D')
4627-
.replace(/;/g, '%3B');
4701+
.replace(/:/g, '%3A')
4702+
.replace(/,/g, '%2C');
46284703
}
46294704
//# sourceMappingURL=command.js.map
46304705

@@ -4849,10 +4924,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
48494924
step((generator = generator.apply(thisArg, _arguments || [])).next());
48504925
});
48514926
};
4927+
var __importStar = (this && this.__importStar) || function (mod) {
4928+
if (mod && mod.__esModule) return mod;
4929+
var result = {};
4930+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
4931+
result["default"] = mod;
4932+
return result;
4933+
};
48524934
Object.defineProperty(exports, "__esModule", { value: true });
48534935
const command_1 = __webpack_require__(431);
4854-
const os = __webpack_require__(87);
4855-
const path = __webpack_require__(622);
4936+
const file_command_1 = __webpack_require__(102);
4937+
const utils_1 = __webpack_require__(82);
4938+
const os = __importStar(__webpack_require__(87));
4939+
const path = __importStar(__webpack_require__(622));
48564940
/**
48574941
* The code to exit an action
48584942
*/
@@ -4873,11 +4957,21 @@ var ExitCode;
48734957
/**
48744958
* Sets env variable for this action and future actions in the job
48754959
* @param name the name of the variable to set
4876-
* @param val the value of the variable
4960+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
48774961
*/
4962+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
48784963
function exportVariable(name, val) {
4879-
process.env[name] = val;
4880-
command_1.issueCommand('set-env', { name }, val);
4964+
const convertedVal = utils_1.toCommandValue(val);
4965+
process.env[name] = convertedVal;
4966+
const filePath = process.env['GITHUB_ENV'] || '';
4967+
if (filePath) {
4968+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
4969+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
4970+
file_command_1.issueCommand('ENV', commandValue);
4971+
}
4972+
else {
4973+
command_1.issueCommand('set-env', { name }, convertedVal);
4974+
}
48814975
}
48824976
exports.exportVariable = exportVariable;
48834977
/**
@@ -4893,7 +4987,13 @@ exports.setSecret = setSecret;
48934987
* @param inputPath
48944988
*/
48954989
function addPath(inputPath) {
4896-
command_1.issueCommand('add-path', {}, inputPath);
4990+
const filePath = process.env['GITHUB_PATH'] || '';
4991+
if (filePath) {
4992+
file_command_1.issueCommand('PATH', inputPath);
4993+
}
4994+
else {
4995+
command_1.issueCommand('add-path', {}, inputPath);
4996+
}
48974997
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
48984998
}
48994999
exports.addPath = addPath;
@@ -4916,12 +5016,22 @@ exports.getInput = getInput;
49165016
* Sets the value of an output.
49175017
*
49185018
* @param name name of the output to set
4919-
* @param value value to store
5019+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
49205020
*/
5021+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
49215022
function setOutput(name, value) {
49225023
command_1.issueCommand('set-output', { name }, value);
49235024
}
49245025
exports.setOutput = setOutput;
5026+
/**
5027+
* Enables or disables the echoing of commands into stdout for the rest of the step.
5028+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
5029+
*
5030+
*/
5031+
function setCommandEcho(enabled) {
5032+
command_1.issue('echo', enabled ? 'on' : 'off');
5033+
}
5034+
exports.setCommandEcho = setCommandEcho;
49255035
//-----------------------------------------------------------------------
49265036
// Results
49275037
//-----------------------------------------------------------------------
@@ -4938,6 +5048,13 @@ exports.setFailed = setFailed;
49385048
//-----------------------------------------------------------------------
49395049
// Logging Commands
49405050
//-----------------------------------------------------------------------
5051+
/**
5052+
* Gets whether Actions Step Debug is on or not
5053+
*/
5054+
function isDebug() {
5055+
return process.env['RUNNER_DEBUG'] === '1';
5056+
}
5057+
exports.isDebug = isDebug;
49415058
/**
49425059
* Writes debug message to user log
49435060
* @param message debug message
@@ -4948,18 +5065,18 @@ function debug(message) {
49485065
exports.debug = debug;
49495066
/**
49505067
* Adds an error issue
4951-
* @param message error issue message
5068+
* @param message error issue message. Errors will be converted to string via toString()
49525069
*/
49535070
function error(message) {
4954-
command_1.issue('error', message);
5071+
command_1.issue('error', message instanceof Error ? message.toString() : message);
49555072
}
49565073
exports.error = error;
49575074
/**
49585075
* Adds an warning issue
4959-
* @param message warning issue message
5076+
* @param message warning issue message. Errors will be converted to string via toString()
49605077
*/
49615078
function warning(message) {
4962-
command_1.issue('warning', message);
5079+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
49635080
}
49645081
exports.warning = warning;
49655082
/**
@@ -5017,8 +5134,9 @@ exports.group = group;
50175134
* Saves state for current action, the state can only be retrieved by this action's post job execution.
50185135
*
50195136
* @param name name of the state to store
5020-
* @param value value to store
5137+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
50215138
*/
5139+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
50225140
function saveState(name, value) {
50235141
command_1.issueCommand('save-state', { name }, value);
50245142
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-projects-column-mirror",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"private": true,
55
"description": "Reflects all changes to a source project column in a target project column",
66
"main": "dist/index.js",

0 commit comments

Comments
 (0)