GithubActionOutput

Class
Final: Yes

Emits GitHub Actions workflow commands through the console output stream.

Description

The helper becomes a no-op outside GitHub Actions, which lets callers route annotations and log groups through a single API without branching on the environment first.

Table of Contents

Properties

 : string|null
 : ConsoleOutputInterface

Methods

 : mixed
__destruct()

Closes any open group before the output instance is destroyed.

 : mixed
debug()

Emits a debug workflow command.

 : void
endGroup()

Ends the current collapsible log group.

 : void
error()

Emits an error annotation for the current workflow step.

 : void
group()

Runs a callback wrapped inside a GitHub Actions log group.

 : TResult
notice()

Emits a notice annotation for the current workflow step.

 : void
startGroup()

Starts a collapsible GitHub Actions log group.

 : void
warning()

Emits a warning annotation for the current workflow step.

 : void
emit()

Emits a raw workflow command after escaping its properties and payload.

 : void
escapeData()

Escapes workflow-command payload data according to GitHub Actions rules.

 : string
escapeProperty()

Escapes workflow-command property values according to GitHub Actions rules.

 : string
supportsWorkflowCommands()

Determines whether workflow commands should be emitted for the current process.

 : bool
Properties
Methods

__construct()

Public
public __construct(ConsoleOutputInterface  $output) : mixed
Parameters
$output : ConsoleOutputInterface

Description

the console output used to emit workflow commands

__destruct()

Public

Closes any open group before the output instance is destroyed.

public __destruct() : mixed

debug()

Public

Emits a debug workflow command.

public debug( string  $message) : void
Parameters
$message : string

Description

the debug message

endGroup()

Public

Ends the current collapsible log group.

public endGroup() : void

error()

Public

Emits an error annotation for the current workflow step.

public error( string  $message[, string|null  $file = null][, int|null  $line = null][, int|null  $column = null]) : void
Parameters
$message : string

Description

the annotation message

$file : string|null = null

Description

the related file when known

$line : int|null = null

Description

the related line when known

$column : int|null = null

Description

the related column when known

group()

Public

Runs a callback wrapped inside a GitHub Actions log group.

public group( string  $title, callable(): TResult  $callback) : TResult
Parameters
$title : string

Description

the group title

$callback : callable(): TResult

Description

the callback to execute within the group

Tags
template
Return values
TResult

notice()

Public

Emits a notice annotation for the current workflow step.

public notice( string  $message[, string|null  $file = null][, int|null  $line = null][, int|null  $column = null]) : void
Parameters
$message : string

Description

the annotation message

$file : string|null = null

Description

the related file when known

$line : int|null = null

Description

the related line when known

$column : int|null = null

Description

the related column when known

startGroup()

Public

Starts a collapsible GitHub Actions log group.

public startGroup( string  $title) : void
Parameters
$title : string

Description

the group title

warning()

Public

Emits a warning annotation for the current workflow step.

public warning( string  $message[, string|null  $file = null][, int|null  $line = null][, int|null  $column = null]) : void
Parameters
$message : string

Description

the annotation message

$file : string|null = null

Description

the related file when known

$line : int|null = null

Description

the related line when known

$column : int|null = null

Description

the related column when known

emit()

Private

Emits a raw workflow command after escaping its properties and payload.

private emit( string  $command[, string  $message = ''][, array<string, string>  $properties = []]) : void
Parameters
$command : string

Description

the GitHub workflow command name

$message : string = ''

Description

the command message

$properties : array<string, string> = []

Description

the optional command properties

escapeData()

Private

Escapes workflow-command payload data according to GitHub Actions rules.

private escapeData( string  $data) : string
Parameters
$data : string
Return values
string

escapeProperty()

Private

Escapes workflow-command property values according to GitHub Actions rules.

private escapeProperty( string  $property) : string
Parameters
$property : string
Return values
string

supportsWorkflowCommands()

Private

Determines whether workflow commands should be emitted for the current process.

private supportsWorkflowCommands() : bool

Description

The helper suppresses workflow commands during the PHPUnit suite even when the tests themselves run inside GitHub Actions.

Return values
bool

Description

true when the current environment supports GitHub workflow commands