2019-05-16 20:40:21 +00:00
|
|
|
# `@actions/core`
|
|
|
|
|
2019-05-17 03:36:45 +00:00
|
|
|
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
2019-05-16 20:40:21 +00:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```
|
2019-05-17 14:29:35 +00:00
|
|
|
// Logging functions
|
|
|
|
export function debug(message: string): void
|
|
|
|
export function warning(message: string): void
|
|
|
|
export function error(message: string): void
|
2019-05-17 14:23:01 +00:00
|
|
|
|
2019-05-17 03:36:45 +00:00
|
|
|
/**
|
|
|
|
* sets env variable for this action and future actions in the job
|
2019-05-17 14:29:35 +00:00
|
|
|
*
|
|
|
|
* @param name the name of the variable to set
|
|
|
|
* @param val the value of the variable
|
|
|
|
* @param options optional. See ExportOptions.
|
2019-05-17 03:36:45 +00:00
|
|
|
*/
|
2019-05-17 14:29:35 +00:00
|
|
|
export function exportVariable(name: string, val: string): void
|
2019-05-16 20:40:21 +00:00
|
|
|
|
2019-05-17 14:38:16 +00:00
|
|
|
/**
|
|
|
|
* exports the variable and registers a secret which will get masked from logs
|
|
|
|
* @param name the name of the variable to set
|
|
|
|
* @param val value of the secret
|
|
|
|
*/
|
|
|
|
export function exportSecret(name: string, val: string) {
|
|
|
|
exportVariable(name, val);
|
|
|
|
intm._issueCommand('set-secret', {}, val);
|
|
|
|
}
|
|
|
|
|
2019-05-17 03:36:45 +00:00
|
|
|
/**
|
2019-05-17 14:29:35 +00:00
|
|
|
* Interface for getInput options
|
2019-05-17 03:36:45 +00:00
|
|
|
*/
|
2019-05-17 14:29:35 +00:00
|
|
|
export interface InputOptions {
|
|
|
|
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
|
|
|
required?: bool;
|
|
|
|
}
|
2019-05-17 03:36:45 +00:00
|
|
|
|
|
|
|
/**
|
2019-05-17 14:29:35 +00:00
|
|
|
* Gets the value of an input. The value is also trimmed.
|
|
|
|
*
|
|
|
|
* @param name name of the input to get
|
|
|
|
* @param options optional. See InputOptions.
|
|
|
|
* @returns string
|
2019-05-17 03:36:45 +00:00
|
|
|
*/
|
2019-05-17 14:29:35 +00:00
|
|
|
export function getInput(name: string, options?: InputOptions): string | undefined
|
2019-05-17 03:36:45 +00:00
|
|
|
|
|
|
|
/**
|
2019-05-17 14:29:35 +00:00
|
|
|
* sets the status of the action to neutral
|
|
|
|
* @param message
|
2019-05-17 03:36:45 +00:00
|
|
|
*/
|
2019-05-17 14:29:35 +00:00
|
|
|
export function setNeutral(message: string): void
|
2019-05-17 03:36:45 +00:00
|
|
|
|
|
|
|
/**
|
2019-05-17 14:29:35 +00:00
|
|
|
* sets the status of the action to failed
|
|
|
|
* @param message
|
2019-05-17 03:36:45 +00:00
|
|
|
*/
|
2019-05-17 14:29:35 +00:00
|
|
|
export function setFailed(message: string): void
|
2019-05-16 20:40:21 +00:00
|
|
|
```
|