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