From e55d6ffbdab99c05d61f35c826133dfb52f1f94e Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Thu, 16 Feb 2023 13:37:18 +0000 Subject: [PATCH] Made an interface that represents Action parameter --- src/utils/actions/action-parameter.ts | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/utils/actions/action-parameter.ts diff --git a/src/utils/actions/action-parameter.ts b/src/utils/actions/action-parameter.ts new file mode 100644 index 0000000..ee32a1d --- /dev/null +++ b/src/utils/actions/action-parameter.ts @@ -0,0 +1,43 @@ +/** + * Represents an input or output parameter of a GitHub Action. + */ +export interface ActionParameter { + /** + * A string description of the parameter. + */ + description: string; + + /** + * A name of the parameter this one's value should be redirected to. + * + * @custom + */ + redirect?: string; + + /** + * The data type of the parameter. + * + * @custom + */ + type?: string; + + /** + * Whether this parameter should be included in the groups by default. + * + * Defaults to `false`. + * + * @custom + */ + unique?: boolean; +} + +/** + * Normalizes the name of a parameter by replacing spaces with underscores and converting it to uppercase. + * + * @param name - The name of the parameter to normalize. + * + * @returns The normalized name of the parameter. + */ +export function normalizeActionParameterName(name: string): string { + return name.replaceAll(" ", "_").toUpperCase(); +}