diff --git a/docs/action-debugging.md b/docs/action-debugging.md index 1c08200e..16f01bf8 100644 --- a/docs/action-debugging.md +++ b/docs/action-debugging.md @@ -18,7 +18,7 @@ All actions ran while this secret is enabled contain additional diagnostic log f ## Step Debug Logs Step debug logs increase the verbosity of a job's logs during and after a job's execution to assist with troubleshooting. -Additional log events with the prefix `##[debug]` will now also appear in the job's logs. +Additional log events with the prefix `::debug::` will now also appear in the job's logs. ### How to Access Step Debug Logs This flag can be enabled by [setting the secret](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) `ACTIONS_STEP_DEBUG` to `true`. diff --git a/docs/commands.md b/docs/commands.md new file mode 100644 index 00000000..85be5aee --- /dev/null +++ b/docs/commands.md @@ -0,0 +1,70 @@ +# :: Commands + +The [core toolkit package](https://github.com/actions/toolkit/tree/master/packages/core) offers a number of convenience functions for +setting results, logging, registering secrets and exporting variables across actions. Sometimes, however, its useful to be able to do +these things in a script or other tool. + +To allow this, we provide a special `::` syntax which, if logged to `stdout`, will allow the runner to perform special behavior on +your commands. The following commands are all supported: + +### Set an environment variable + +To set an environment variable, use `::set-env`: + +```sh +echo ::set-env name=FOO::BAR +``` + +Running `$FOO` in a future step will now return `BAR` + +### PATH Manipulation + +To prepend a string to PATH, use `::addPath`: + +```sh +echo ::add-path::BAR +``` + +Running `$PATH` in a future step will now return `BAR:{Previous Path}`; + +### Set outputs + +To set an output for the step, use `::set-output`: + +```sh +echo ::set-output name=FOO::BAR +``` + +Running `steps.[step-id].outputs.FOO` in your Yaml will now give you `BAR` + +```yaml +steps: + - name: Set the value + id: step_one + run: echo ::set-output name=FOO::BAR + - name: Use it + run: echo ${{ steps.step_one.outputs.FOO }} +``` + +### Masking Values in Logs + +To mask a value in the logs, use `::add-mask`: + +```sh +echo ::add-mask::BAR +``` + +Now, future logs containing BAR will be masked. E.g. running `echo "Hello FOO BAR World"` will now print `Hello FOO **** World`. + +CAUTION: Do **not** mask short values if you can avoid it, it could render your output unreadable (and future steps' output as well). +For example, if you mask the letter `l`, running `echo "Hello FOO BAR World"` will now print `He*********o FOO BAR Wor****d` + +### Log Level + +Finally, there are several commands to emit different levels of log output: + +| log level | example usage | +|---|---| +| [debug](https://github.com/actions/toolkit/blob/master/docs/action-debugging.md) | `echo ::debug::My debug message` | +| warning | `echo ::warning::My warning message` | +| error | `echo ::error::My error message` | \ No newline at end of file