This will mask either a value or an envvar and prevent them (or their content) from showing up in the Github Actions log.
ATTENTION: Currently the masking of envvar values will only take effect in the NEXT step of the workflow. Values that are masked directly are masked immediately. This is not very clear in the Github Docs but very important.

octo_mask_value(value)

octo_mask_envvar(name)

Arguments

value

A single value to mask, coercible to string.

name

Name of the envvar to mask.

Details

The masking is not restricted to R output, rather it will work for any logged output. For a practical demonstration please see the octolog example workflow

Additionally some values and envvars will be masked automatically by github, though this behaviour is poorly documented. It looks like anything with "TOKEN" will be masked. Related Issues here and here.

See also

Examples

octo_mask_value("secret_token123")
#> NULL
# The mask takes effect in the NEXT step
print("Current token: secret_token123")
#> [1] "Current token: secret_token123"
# Will log as
# "Current token:***"

Sys.setenv("SECRET_TOKEN" = "007")
octo_mask_envvar("SECRET_TOKEN")
#> Error in octo_mask_envvar("SECRET_TOKEN"): could not find function "octo_mask_envvar"
# The mask takes effect in the NEXT step
print(Sys.getenv("SECRET_TOKEN"))
#> [1] "007"
# Will log as
# "***"