@@ -525,7 +525,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
525
525
});
526
526
};
527
527
Object.defineProperty(exports, "__esModule", ({ value: true }));
528
- 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;
528
+ 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;
529
529
const command_1 = __nccwpck_require__(7351);
530
530
const file_command_1 = __nccwpck_require__(717);
531
531
const utils_1 = __nccwpck_require__(5278);
@@ -703,19 +703,30 @@ exports.debug = debug;
703
703
/**
704
704
* Adds an error issue
705
705
* @param message error issue message. Errors will be converted to string via toString()
706
+ * @param properties optional properties to add to the annotation.
706
707
*/
707
- function error(message) {
708
- command_1.issue ('error', message instanceof Error ? message.toString() : message);
708
+ function error(message, properties = {} ) {
709
+ command_1.issueCommand ('error', utils_1.toCommandProperties(properties) , message instanceof Error ? message.toString() : message);
709
710
}
710
711
exports.error = error;
711
712
/**
712
- * Adds an warning issue
713
+ * Adds a warning issue
713
714
* @param message warning issue message. Errors will be converted to string via toString()
715
+ * @param properties optional properties to add to the annotation.
714
716
*/
715
- function warning(message) {
716
- command_1.issue ('warning', message instanceof Error ? message.toString() : message);
717
+ function warning(message, properties = {} ) {
718
+ command_1.issueCommand ('warning', utils_1.toCommandProperties(properties) , message instanceof Error ? message.toString() : message);
717
719
}
718
720
exports.warning = warning;
721
+ /**
722
+ * Adds a notice issue
723
+ * @param message notice issue message. Errors will be converted to string via toString()
724
+ * @param properties optional properties to add to the annotation.
725
+ */
726
+ function notice(message, properties = {}) {
727
+ command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
728
+ }
729
+ exports.notice = notice;
719
730
/**
720
731
* Writes info to log with console.log.
721
732
* @param message info message
@@ -849,7 +860,7 @@ exports.issueCommand = issueCommand;
849
860
// We use any as a valid input type
850
861
/* eslint-disable @typescript-eslint/no-explicit-any */
851
862
Object.defineProperty(exports, "__esModule", ({ value: true }));
852
- exports.toCommandValue = void 0;
863
+ exports.toCommandProperties = exports. toCommandValue = void 0;
853
864
/**
854
865
* Sanitizes an input into a string so it can be passed into issueCommand safely
855
866
* @param input input to sanitize into a string
@@ -864,6 +875,25 @@ function toCommandValue(input) {
864
875
return JSON.stringify(input);
865
876
}
866
877
exports.toCommandValue = toCommandValue;
878
+ /**
879
+ *
880
+ * @param annotationProperties
881
+ * @returns The command properties to send with the actual annotation command
882
+ * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
883
+ */
884
+ function toCommandProperties(annotationProperties) {
885
+ if (!Object.keys(annotationProperties).length) {
886
+ return {};
887
+ }
888
+ return {
889
+ title: annotationProperties.title,
890
+ line: annotationProperties.startLine,
891
+ endLine: annotationProperties.endLine,
892
+ col: annotationProperties.startColumn,
893
+ endColumn: annotationProperties.endColumn
894
+ };
895
+ }
896
+ exports.toCommandProperties = toCommandProperties;
867
897
//# sourceMappingURL=utils.js.map
868
898
869
899
/***/ }),
0 commit comments