UNPKG

4.61 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 * Sets env variable for this action and future actions in the job
25 * @param name the name of the variable to set
26 * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
27 */
28export declare function exportVariable(name: string, val: any): void;
29/**
30 * Registers a secret which will get masked from logs
31 * @param secret value of the secret
32 */
33export declare function setSecret(secret: string): void;
34/**
35 * Prepends inputPath to the PATH (for this action and future actions)
36 * @param inputPath
37 */
38export declare function addPath(inputPath: string): void;
39/**
40 * Gets the value of an input.
41 * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
42 * Returns an empty string if the value is not defined.
43 *
44 * @param name name of the input to get
45 * @param options optional. See InputOptions.
46 * @returns string
47 */
48export declare function getInput(name: string, options?: InputOptions): string;
49/**
50 * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
51 * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
52 * The return value is also in boolean type.
53 * ref: https://yaml.org/spec/1.2/spec.html#id2804923
54 *
55 * @param name name of the input to get
56 * @param options optional. See InputOptions.
57 * @returns boolean
58 */
59export declare function getBooleanInput(name: string, options?: InputOptions): boolean;
60/**
61 * Sets the value of an output.
62 *
63 * @param name name of the output to set
64 * @param value value to store. Non-string values will be converted to a string via JSON.stringify
65 */
66export declare function setOutput(name: string, value: any): void;
67/**
68 * Enables or disables the echoing of commands into stdout for the rest of the step.
69 * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
70 *
71 */
72export declare function setCommandEcho(enabled: boolean): void;
73/**
74 * Sets the action status to failed.
75 * When the action exits it will be with an exit code of 1
76 * @param message add error issue message
77 */
78export declare function setFailed(message: string | Error): void;
79/**
80 * Gets whether Actions Step Debug is on or not
81 */
82export declare function isDebug(): boolean;
83/**
84 * Writes debug message to user log
85 * @param message debug message
86 */
87export declare function debug(message: string): void;
88/**
89 * Adds an error issue
90 * @param message error issue message. Errors will be converted to string via toString()
91 */
92export declare function error(message: string | Error): void;
93/**
94 * Adds an warning issue
95 * @param message warning issue message. Errors will be converted to string via toString()
96 */
97export declare function warning(message: string | Error): void;
98/**
99 * Writes info to log with console.log.
100 * @param message info message
101 */
102export declare function info(message: string): void;
103/**
104 * Begin an output group.
105 *
106 * Output until the next `groupEnd` will be foldable in this group
107 *
108 * @param name The name of the output group
109 */
110export declare function startGroup(name: string): void;
111/**
112 * End an output group.
113 */
114export declare function endGroup(): void;
115/**
116 * Wrap an asynchronous function call in a group.
117 *
118 * Returns the same type as the function itself.
119 *
120 * @param name The name of the group
121 * @param fn The function to wrap in the group
122 */
123export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
124/**
125 * Saves state for current action, the state can only be retrieved by this action's post job execution.
126 *
127 * @param name name of the state to store
128 * @param value value to store. Non-string values will be converted to a string via JSON.stringify
129 */
130export declare function saveState(name: string, value: any): void;
131/**
132 * Gets the value of an state set by this action's main execution.
133 *
134 * @param name name of the state to get
135 * @returns string
136 */
137export declare function getState(name: string): string;