Skip to content

Commit

Permalink
docs: Fix two typos and add some blank lines to commands.md (#607)
Browse files Browse the repository at this point in the history
* docs: Fix two typos and add some blank lines to commands.md

* Update docs/commands.md

Co-authored-by: Simran <Simran-B@users.noreply.github.com>

Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com>
  • Loading branch information
Simran-B and thboop committed Apr 27, 2021
1 parent cf3d935 commit dd04665
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.

Expand All @@ -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
Expand All @@ -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}
Expand All @@ -183,13 +188,15 @@ 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 {}
```

### 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
Expand Down

0 comments on commit dd04665

Please sign in to comment.