-
Notifications
You must be signed in to change notification settings - Fork 2
GitHubActionsLogHandler
A logger for GitHub Actions workflows.
public struct GitHubActionsLogHandler: LogHandler
See "Workflow commands for GitHub Actions."
LogHandler
Get or set the configured log level.
var logLevel: Logger.Level = .debug
Get or set the entire metadata storage as a dictionary.
var metadata: Logger.Metadata = [:]
Prepends a directory to the system PATH
variable
for all subsequent actions in the current job.
public func addSystemPath(_ path: String)
The currently running action cannot access the new path variable.
::add-path::{path}
- path: The directory path to prepend to the system
PATH
variable.
Prints a message to the log at the specified level.
public func log(level: Logger.Level, message: Logger.Message, metadata: Logger.Metadata?, file: String, function: String, line: UInt)
This method is called when a LogHandler
must emit a log message.
There is no need for the LogHandler
to check
if the level
is above or below the configured logLevel
as Logger
already performed this check and determined that a message should be logged.
::{level} file={name},line={line}::{message}
Note: You must create a secret named
ACTIONS_STEP_DEBUG
with the valuetrue
to see the debug messages set by this command in the log. To learn more about creating secrets and using them in a step, see "Creating and using encrypted secrets."
- level: The log level the message was logged at.
- message: The message to log. To obtain a
String
representation callmessage.description
. - metadata: The metadata associated to this log message.
- file: The file the log message was emitted from.
- function: The function the log line was emitted from.
- line: The line the log message was emitted from.
Masking a value prevents a string or variable from being printed in the log. Each masked word separated by whitespace is replaced with the * character. You can use an environment variable or string for the mask's value.
public func mask(value: String)
::add-mask::{value}
Creates or updates an environment variable for any actions running next in a job.
public func setEnvironmentVariable(name: String, value: String)
The action that creates or updates the environment variable does not have access to the new value, but all subsequent actions in a job will have access. Environment variables are case-sensitive and you can include punctuation.
::set-env name={name}::{value}
- name: The environment variable name
- value: The environment variable value
Sets an action's output parameter.
public func setOutputParameter(name: String, value: String)
Optionally, you can also declare output parameters in an action's metadata file. For more information, see "Metadata syntax for GitHub Actions."
::set-output name={name}::{value}
- name: The environment variable name
- value: The environment variable value
Returns a handler that logs to standard output (STDOUT
).
public static func standardOutput(label: String) -> GitHubActionsLogHandler
- label: A label identifying the logging handler.
Performs the specified closure without processing any workflow commands.
public func withoutProcessingWorkflowCommands(_ body: () -> Void)
You can use this function to log dynamic values without accidentally running a workflow command. For example, you could stop logging to output an entire script that has comments.
::stop-commands::{token}
...
::{token}::
- body: Work to be performed without running workflow commands.
Generated at 2020-03-25T20:11:54+0000 using swift-doc.