@actions/core

  • Version 1.8.2
  • Published
  • 71.2 kB
  • 1 dependency
  • MIT license

Install

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

Overview

Actions core lib

Index

Variables

variable markdownSummary

const markdownSummary: Summary;
  • Deprecated

    use core.summary

variable summary

const summary: Summary;

    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, properties?: AnnotationProperties) => void;
    • Adds an error issue

      Parameter message

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

      Parameter properties

      optional properties to add to the annotation.

    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 getIDToken

    getIDToken: (aud?: string) => Promise<string>;

      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 getMultilineInput

      getMultilineInput: (name: string, options?: InputOptions) => string[];
      • Gets the values of an multiline input. Each value is also trimmed.

        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 notice

      notice: (message: string | Error, properties?: AnnotationProperties) => void;
      • Adds a notice issue

        Parameter message

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

        Parameter properties

        optional properties to add to the annotation.

      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, properties?: AnnotationProperties) => void;
      • Adds a warning issue

        Parameter message

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

        Parameter properties

        optional properties to add to the annotation.

      Interfaces

      interface AnnotationProperties

      interface AnnotationProperties {}
      • Optional properties that can be sent with annotatation commands (notice, error, and warning) See: https://docs.github.com/en/rest/reference/checks#create-a-check-run for more information about annotations.

      property endColumn

      endColumn?: number;
      • The start column for the annotation. Cannot be sent when startLine and endLine are different values. Defaults to startColumn when startColumn is provided.

      property endLine

      endLine?: number;
      • The end line for the annotation. Defaults to startLine when startLine is provided.

      property file

      file?: string;
      • The path of the file for which the annotation should be created.

      property startColumn

      startColumn?: number;
      • The start column for the annotation. Cannot be sent when startLine and endLine are different values.

      property startLine

      startLine?: number;
      • The start line for the annotation.

      property title

      title?: string;
      • A title for the annotation.

      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 (2)

      Dependencies (1)

      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>