diff --git a/docs/commands.md b/docs/commands.md index 4df725d3..eb075445 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -57,7 +57,7 @@ For example, if you mask the letter `l`, running `echo "Hello FOO BAR World"` wi ### Group and Ungroup Log Lines -Emitting a group with a title will instruct the logs to create a collapsable region up to the next ungroup command. +Emitting a group with a title will instruct the logs to create a collapsible region up to the next endgroup command. ```bash echo "::group::my title" @@ -72,6 +72,7 @@ function endGroup(): void {} ``` ### Problem Matchers + Problems matchers can be used to scan a build's output to automatically surface lines to the user that matches the provided pattern. A file path to a .json Problem Matcher must be provided. See [Problem Matchers](problem-matchers.md) for more information on how to define a Problem Matcher. ```bash @@ -81,6 +82,7 @@ echo "::remove-matcher owner=eslint-compact::" `add-matcher` takes a path to a Problem Matcher file `remove-matcher` removes a Problem Matcher by owner + ### Save State Save a state to an environmental variable that can later be used in the main or post action. @@ -102,6 +104,7 @@ There are several commands to emit different levels of log output: | error | `echo "::error::My error message"` | ### Command Echoing + By default, the echoing of commands to stdout only occurs if [Step Debugging is enabled](./action-debugging.md#How-to-Access-Step-Debug-Logs) You can enable or disable this for the current step by using the `echo` command. @@ -127,12 +130,12 @@ The `add-mask`, `debug`, `warning` and `error` commands do not support echoing. ### Command Prompt CMD processes the `"` character differently from other shells when echoing. In CMD, the above snippets should have the `"` characters removed in order to correctly process. For example, the set output command would be: + ```cmd echo ::set-output name=FOO::BAR ``` - -# Environment files +## Environment files During the execution of a workflow, the runner generates temporary files that can be used to perform certain actions. The path to these files are exposed via environment variables. You will need to use the `utf-8` encoding when writing to these files to ensure proper processing of the commands. Multiple commands can be written to the same file, separated by newlines. @@ -146,7 +149,8 @@ echo "FOO=BAR" >> $GITHUB_ENV Running `$FOO` in a future step will now return `BAR` -For multiline strings, you may use a heredoc style syntax with your choice of delimeter. In the below example, we use `EOF` +For multiline strings, you may use a heredoc style syntax with your choice of delimeter. In the below example, we use `EOF`. + ``` steps: - name: Set the value @@ -160,6 +164,7 @@ steps: This would set the value of the `JSON_RESPONSE` env variable to the value of the curl response. The expected syntax for the heredoc style is: + ``` {VARIABLE_NAME}<<{DELIMETER} {VARIABLE_VALUE} @@ -183,6 +188,7 @@ echo "/Users/test/.nvm/versions/node/v12.18.3/bin" >> $GITHUB_PATH Running `$PATH` in a future step will now return `/Users/test/.nvm/versions/node/v12.18.3/bin:{Previous Path}`; This is wrapped by the core addPath method: + ```javascript export function addPath(inputPath: string): void {} ``` @@ -190,6 +196,7 @@ export function addPath(inputPath: string): void {} ### Powershell Powershell does not use UTF8 by default. You will want to make sure you write in the correct encoding. For example, to set the path: + ``` steps: - run: echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append