Files
send-mail/node_modules/@actions/core/lib/utils.js

35 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-11-12 16:30:46 +01:00
// We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */
/**
* Sanitizes an input into a string so it can be passed into issueCommand safely
* @param input input to sanitize into a string
*/
export function toCommandValue(input) {
2020-11-12 16:30:46 +01:00
if (input === null || input === undefined) {
return '';
}
else if (typeof input === 'string' || input instanceof String) {
return input;
}
return JSON.stringify(input);
}
2022-10-21 16:52:45 +02:00
/**
*
* @param annotationProperties
* @returns The command properties to send with the actual annotation command
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
*/
export function toCommandProperties(annotationProperties) {
2022-10-21 16:52:45 +02:00
if (!Object.keys(annotationProperties).length) {
return {};
}
return {
title: annotationProperties.title,
file: annotationProperties.file,
line: annotationProperties.startLine,
endLine: annotationProperties.endLine,
col: annotationProperties.startColumn,
endColumn: annotationProperties.endColumn
};
}
2020-11-12 16:30:46 +01:00
//# sourceMappingURL=utils.js.map