@actions/core

  • Version 1.3.0
  • Published
  • 34.9 kB
  • No dependencies
  • MIT license

Install

npm i @actions/core
yarn add @actions/core
pnpm add @actions/core

Overview

Actions core lib

Index

Functions

function addPath

addPath: (inputPath: string) => void;
  • Prepends inputPath to the PATH (for this action and future actions)

    Parameter inputPath

function debug

debug: (message: string) => void;
  • Writes debug message to user log

    Parameter message

    debug message

function endGroup

endGroup: () => void;
  • End an output group.

function error

error: (message: string | Error) => void;
  • Adds an error issue

    Parameter message

    error issue message. Errors will be converted to string via toString()

function exportVariable

exportVariable: (name: string, val: any) => void;
  • Sets env variable for this action and future actions in the job

    Parameter name

    the name of the variable to set

    Parameter val

    the value of the variable. Non-string values will be converted to a string via JSON.stringify

function getBooleanInput

getBooleanInput: (name: string, options?: InputOptions) => boolean;
  • Gets the input value of the boolean type in the YAML 1.2 "core schema" specification. Support boolean input list: true | True | TRUE | false | False | FALSE . The return value is also in boolean type. ref: https://yaml.org/spec/1.2/spec.html#id2804923

    Parameter name

    name of the input to get

    Parameter options

    optional. See InputOptions.

    Returns

    boolean

function getInput

getInput: (name: string, options?: InputOptions) => string;
  • Gets the value of an input. Unless trimWhitespace is set to false in InputOptions, the value is also trimmed. Returns an empty string if the value is not defined.

    Parameter name

    name of the input to get

    Parameter options

    optional. See InputOptions.

    Returns

    string

function getState

getState: (name: string) => string;
  • Gets the value of an state set by this action's main execution.

    Parameter name

    name of the state to get

    Returns

    string

function group

group: <T>(name: string, fn: () => Promise<T>) => Promise<T>;
  • Wrap an asynchronous function call in a group.

    Returns the same type as the function itself.

    Parameter name

    The name of the group

    Parameter fn

    The function to wrap in the group

function info

info: (message: string) => void;
  • Writes info to log with console.log.

    Parameter message

    info message

function isDebug

isDebug: () => boolean;
  • Gets whether Actions Step Debug is on or not

function saveState

saveState: (name: string, value: any) => void;
  • Saves state for current action, the state can only be retrieved by this action's post job execution.

    Parameter name

    name of the state to store

    Parameter value

    value to store. Non-string values will be converted to a string via JSON.stringify

function setCommandEcho

setCommandEcho: (enabled: boolean) => void;
  • Enables or disables the echoing of commands into stdout for the rest of the step. Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.

function setFailed

setFailed: (message: string | Error) => void;
  • Sets the action status to failed. When the action exits it will be with an exit code of 1

    Parameter message

    add error issue message

function setOutput

setOutput: (name: string, value: any) => void;
  • Sets the value of an output.

    Parameter name

    name of the output to set

    Parameter value

    value to store. Non-string values will be converted to a string via JSON.stringify

function setSecret

setSecret: (secret: string) => void;
  • Registers a secret which will get masked from logs

    Parameter secret

    value of the secret

function startGroup

startGroup: (name: string) => void;
  • Begin an output group.

    Output until the next groupEnd will be foldable in this group

    Parameter name

    The name of the output group

function warning

warning: (message: string | Error) => void;
  • Adds an warning issue

    Parameter message

    warning issue message. Errors will be converted to string via toString()

Interfaces

interface InputOptions

interface InputOptions {}
  • Interface for getInput options

property required

required?: boolean;
  • Optional. Whether the input is required. If required and not present, will throw. Defaults to false

property trimWhitespace

trimWhitespace?: boolean;
  • Optional. Whether leading/trailing whitespace will be trimmed for the input. Defaults to true

Enums

enum ExitCode

enum ExitCode {
Success = 0,
Failure = 1,
}
  • The code to exit an action

member Failure

Failure = 1
  • A code indicating that the action was a failure

member Success

Success = 0
  • A code indicating that the action was successful

Package Files (1)

Dependencies (0)

No dependencies.

Dev Dependencies (1)

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@actions/core.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@actions/core)
  • HTML
    <a href="https://www.jsdocs.io/package/@actions/core"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>