Skip to content

Commit c107184

Browse files
committed
Set error type to any
1 parent 24a050e commit c107184

File tree

3 files changed

+6747
-17
lines changed

3 files changed

+6747
-17
lines changed

dist/index.js

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ function run() {
5353
labels: utils.getInputAsArray('labels'),
5454
assignees: utils.getInputAsArray('assignees')
5555
};
56-
core.debug(`Inputs: ${util_1.inspect(inputs)}`);
56+
core.debug(`Inputs: ${(0, util_1.inspect)(inputs)}`);
5757
const [owner, repo] = inputs.repository.split('/');
58-
core.debug(`Repo: ${util_1.inspect(repo)}`);
58+
core.debug(`Repo: ${(0, util_1.inspect)(repo)}`);
5959
const octokit = github.getOctokit(inputs.token);
6060
// Check the file exists
6161
if (yield util.promisify(fs.exists)(inputs.contentFilepath)) {
@@ -116,7 +116,7 @@ function run() {
116116
}
117117
}
118118
catch (error) {
119-
core.debug(util_1.inspect(error));
119+
core.debug((0, util_1.inspect)(error));
120120
core.setFailed(error.message);
121121
}
122122
});
@@ -301,7 +301,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
301301
});
302302
};
303303
Object.defineProperty(exports, "__esModule", ({ value: true }));
304-
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
304+
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
305305
const command_1 = __nccwpck_require__(351);
306306
const file_command_1 = __nccwpck_require__(717);
307307
const utils_1 = __nccwpck_require__(278);
@@ -479,19 +479,30 @@ exports.debug = debug;
479479
/**
480480
* Adds an error issue
481481
* @param message error issue message. Errors will be converted to string via toString()
482+
* @param properties optional properties to add to the annotation.
482483
*/
483-
function error(message) {
484-
command_1.issue('error', message instanceof Error ? message.toString() : message);
484+
function error(message, properties = {}) {
485+
command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
485486
}
486487
exports.error = error;
487488
/**
488-
* Adds an warning issue
489+
* Adds a warning issue
489490
* @param message warning issue message. Errors will be converted to string via toString()
491+
* @param properties optional properties to add to the annotation.
490492
*/
491-
function warning(message) {
492-
command_1.issue('warning', message instanceof Error ? message.toString() : message);
493+
function warning(message, properties = {}) {
494+
command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
493495
}
494496
exports.warning = warning;
497+
/**
498+
* Adds a notice issue
499+
* @param message notice issue message. Errors will be converted to string via toString()
500+
* @param properties optional properties to add to the annotation.
501+
*/
502+
function notice(message, properties = {}) {
503+
command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
504+
}
505+
exports.notice = notice;
495506
/**
496507
* Writes info to log with console.log.
497508
* @param message info message
@@ -625,7 +636,7 @@ exports.issueCommand = issueCommand;
625636
// We use any as a valid input type
626637
/* eslint-disable @typescript-eslint/no-explicit-any */
627638
Object.defineProperty(exports, "__esModule", ({ value: true }));
628-
exports.toCommandValue = void 0;
639+
exports.toCommandProperties = exports.toCommandValue = void 0;
629640
/**
630641
* Sanitizes an input into a string so it can be passed into issueCommand safely
631642
* @param input input to sanitize into a string
@@ -640,6 +651,25 @@ function toCommandValue(input) {
640651
return JSON.stringify(input);
641652
}
642653
exports.toCommandValue = toCommandValue;
654+
/**
655+
*
656+
* @param annotationProperties
657+
* @returns The command properties to send with the actual annotation command
658+
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
659+
*/
660+
function toCommandProperties(annotationProperties) {
661+
if (!Object.keys(annotationProperties).length) {
662+
return {};
663+
}
664+
return {
665+
title: annotationProperties.title,
666+
line: annotationProperties.startLine,
667+
endLine: annotationProperties.endLine,
668+
col: annotationProperties.startColumn,
669+
endColumn: annotationProperties.endColumn
670+
};
671+
}
672+
exports.toCommandProperties = toCommandProperties;
643673
//# sourceMappingURL=utils.js.map
644674

645675
/***/ }),

0 commit comments

Comments
 (0)