UNPKG

6.73 kBTypeScriptView Raw
1/**
2 * Interface for getInput options
3 */
4export interface InputOptions {
5 /** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
6 required?: boolean;
7 /** Optional. Whether leading/trailing whitespace will be trimmed for the input. Defaults to true */
8 trimWhitespace?: boolean;
9}
10/**
11 * The code to exit an action
12 */
13export declare enum ExitCode {
14 /**
15 * A code indicating that the action was successful
16 */
17 Success = 0,
18 /**
19 * A code indicating that the action was a failure
20 */
21 Failure = 1
22}
23/**
24 * Optional properties that can be sent with annotation commands (notice, error, and warning)
25 * See: https://docs.github.com/en/rest/reference/checks#create-a-check-run for more information about annotations.
26 */
27export interface AnnotationProperties {
28 /**
29 * A title for the annotation.
30 */
31 title?: string;
32 /**
33 * The path of the file for which the annotation should be created.
34 */
35 file?: string;
36 /**
37 * The start line for the annotation.
38 */
39 startLine?: number;
40 /**
41 * The end line for the annotation. Defaults to `startLine` when `startLine` is provided.
42 */
43 endLine?: number;
44 /**
45 * The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
46 */
47 startColumn?: number;
48 /**
49 * The end column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
50 * Defaults to `startColumn` when `startColumn` is provided.
51 */
52 endColumn?: number;
53}
54/**
55 * Sets env variable for this action and future actions in the job
56 * @param name the name of the variable to set
57 * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
58 */
59export declare function exportVariable(name: string, val: any): void;
60/**
61 * Registers a secret which will get masked from logs
62 * @param secret value of the secret
63 */
64export declare function setSecret(secret: string): void;
65/**
66 * Prepends inputPath to the PATH (for this action and future actions)
67 * @param inputPath
68 */
69export declare function addPath(inputPath: string): void;
70/**
71 * Gets the value of an input.
72 * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
73 * Returns an empty string if the value is not defined.
74 *
75 * @param name name of the input to get
76 * @param options optional. See InputOptions.
77 * @returns string
78 */
79export declare function getInput(name: string, options?: InputOptions): string;
80/**
81 * Gets the values of an multiline input. Each value is also trimmed.
82 *
83 * @param name name of the input to get
84 * @param options optional. See InputOptions.
85 * @returns string[]
86 *
87 */
88export declare function getMultilineInput(name: string, options?: InputOptions): string[];
89/**
90 * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
91 * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
92 * The return value is also in boolean type.
93 * ref: https://yaml.org/spec/1.2/spec.html#id2804923
94 *
95 * @param name name of the input to get
96 * @param options optional. See InputOptions.
97 * @returns boolean
98 */
99export declare function getBooleanInput(name: string, options?: InputOptions): boolean;
100/**
101 * Sets the value of an output.
102 *
103 * @param name name of the output to set
104 * @param value value to store. Non-string values will be converted to a string via JSON.stringify
105 */
106export declare function setOutput(name: string, value: any): void;
107/**
108 * Enables or disables the echoing of commands into stdout for the rest of the step.
109 * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
110 *
111 */
112export declare function setCommandEcho(enabled: boolean): void;
113/**
114 * Sets the action status to failed.
115 * When the action exits it will be with an exit code of 1
116 * @param message add error issue message
117 */
118export declare function setFailed(message: string | Error): void;
119/**
120 * Gets whether Actions Step Debug is on or not
121 */
122export declare function isDebug(): boolean;
123/**
124 * Writes debug message to user log
125 * @param message debug message
126 */
127export declare function debug(message: string): void;
128/**
129 * Adds an error issue
130 * @param message error issue message. Errors will be converted to string via toString()
131 * @param properties optional properties to add to the annotation.
132 */
133export declare function error(message: string | Error, properties?: AnnotationProperties): void;
134/**
135 * Adds a warning issue
136 * @param message warning issue message. Errors will be converted to string via toString()
137 * @param properties optional properties to add to the annotation.
138 */
139export declare function warning(message: string | Error, properties?: AnnotationProperties): void;
140/**
141 * Adds a notice issue
142 * @param message notice issue message. Errors will be converted to string via toString()
143 * @param properties optional properties to add to the annotation.
144 */
145export declare function notice(message: string | Error, properties?: AnnotationProperties): void;
146/**
147 * Writes info to log with console.log.
148 * @param message info message
149 */
150export declare function info(message: string): void;
151/**
152 * Begin an output group.
153 *
154 * Output until the next `groupEnd` will be foldable in this group
155 *
156 * @param name The name of the output group
157 */
158export declare function startGroup(name: string): void;
159/**
160 * End an output group.
161 */
162export declare function endGroup(): void;
163/**
164 * Wrap an asynchronous function call in a group.
165 *
166 * Returns the same type as the function itself.
167 *
168 * @param name The name of the group
169 * @param fn The function to wrap in the group
170 */
171export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
172/**
173 * Saves state for current action, the state can only be retrieved by this action's post job execution.
174 *
175 * @param name name of the state to store
176 * @param value value to store. Non-string values will be converted to a string via JSON.stringify
177 */
178export declare function saveState(name: string, value: any): void;
179/**
180 * Gets the value of an state set by this action's main execution.
181 *
182 * @param name name of the state to get
183 * @returns string
184 */
185export declare function getState(name: string): string;
186export declare function getIDToken(aud?: string): Promise<string>;
187/**
188 * Summary exports
189 */
190export { summary } from './summary';
191/**
192 * @deprecated use core.summary
193 */
194export { markdownSummary } from './summary';
195/**
196 * Path exports
197 */
198export { toPosixPath, toWin32Path, toPlatformPath } from './path-utils';