mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-06 04:33:25 +08:00
Add notice annotation and support more annotation fields (#855)
* Add support for notice annotation and additional properties
* Add additional tests
* Update readme
* Change casing for endLine and endColumn
* Update utils.ts
* Update README.md
* Rename files to have internal- nomenclature
* Revert "Rename files to have internal- nomenclature"
This reverts commit 7911689f29.
* Update utils.ts
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import {AnnotationProperties} from './core'
|
||||
import {CommandProperties} from './command'
|
||||
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
@@ -13,3 +16,25 @@ export function toCommandValue(input: any): string {
|
||||
}
|
||||
return JSON.stringify(input)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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: AnnotationProperties
|
||||
): CommandProperties {
|
||||
if (!Object.keys(annotationProperties).length) {
|
||||
return {}
|
||||
}
|
||||
|
||||
return {
|
||||
title: annotationProperties.title,
|
||||
line: annotationProperties.startLine,
|
||||
endLine: annotationProperties.endLine,
|
||||
col: annotationProperties.startColumn,
|
||||
endColumn: annotationProperties.endColumn
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user