These functions are a drop-in replacements for cli::cli_warn() and friends. If used while R is running within a Github Action, the conditions will be signaled in such a way that they will create annotations on the files affected. Even if enable_github_colors() was used the conditions will not have colors in the log as the color codes break the annotation.

octo_debug(message, .envir = parent.frame())

octo_inform(
  message,
  ...,
  trace = rlang::trace_back(),
  title = NULL,
  .envir = parent.frame()
)

octo_warn(
  message,
  ...,
  trace = rlang::trace_back(),
  title = NULL,
  .envir = parent.frame()
)

octo_abort(
  message,
  ...,
  trace = rlang::trace_back(),
  title = NULL,
  .envir = parent.frame(),
  .fail_fast = getOption("octolog.fail_fast") %||% TRUE
)

Arguments

message

It is formatted via a call to cli_bullets().

.envir

Environment to evaluate the glue expressions in.

...

Passed to rlang::abort(), rlang::warn() or rlang::inform().

trace

An rlang::trace_back() will only be passed to rlang::abort() if not missing().

title

A custom title for the Github annotation.

.fail_fast

An error on Github will not kill the R process if this is set to FALSE. Use the option octolog.fail_fast to set the value globally.`

Details

Annotations will only have file and line references if the option keep.source = TRUE is set. It defaults to FALSE when in non-interactive use.

The file path for the annotations will be relative to the R working directory, if you want to change that set the envvar OCTOLOG_START_DIR to the dir the path should be relative to.

Functions

  • octo_debug: A debug message which is only visible if the secret ACTIONS_STEP_DEBUG is set. For local use set option octolog.debug = TRUE.

See also

Examples

Sys.setenv(GITHUB_ACTIONS = "")
octo_warn(c("A warning message", i = "Try something else!"),
  title = "Custom Title"
)
#> Error in octo_warn(c("A warning message", i = "Try something else!"),     title = "Custom Title"): could not find function "octo_warn"
Sys.setenv(GITHUB_ACTIONS = "TRUE")
octo_warn(c("A warning message", i = "Try something else!"),
  title = "Custom Title"
)
#> Error in octo_warn(c("A warning message", i = "Try something else!"),     title = "Custom Title"): could not find function "octo_warn"