mirror of https://github.com/actions/toolkit
docs: Fix two typos and add some blank lines to commands.md (#607)
* 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>pull/725/head
parent
cf3d93512b
commit
dd046652c3
|
@ -57,7 +57,7 @@ For example, if you mask the letter `l`, running `echo "Hello FOO BAR World"` wi
|
||||||
|
|
||||||
### Group and Ungroup Log Lines
|
### 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
|
```bash
|
||||||
echo "::group::my title"
|
echo "::group::my title"
|
||||||
|
@ -72,6 +72,7 @@ function endGroup(): void {}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Problem Matchers
|
### 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.
|
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
|
```bash
|
||||||
|
@ -81,6 +82,7 @@ echo "::remove-matcher owner=eslint-compact::"
|
||||||
|
|
||||||
`add-matcher` takes a path to a Problem Matcher file
|
`add-matcher` takes a path to a Problem Matcher file
|
||||||
`remove-matcher` removes a Problem Matcher by owner
|
`remove-matcher` removes a Problem Matcher by owner
|
||||||
|
|
||||||
### Save State
|
### Save State
|
||||||
|
|
||||||
Save a state to an environmental variable that can later be used in the main or post action.
|
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"` |
|
| error | `echo "::error::My error message"` |
|
||||||
|
|
||||||
### Command Echoing
|
### 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)
|
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.
|
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
|
### 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 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
|
```cmd
|
||||||
echo ::set-output name=FOO::BAR
|
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.
|
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`
|
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:
|
steps:
|
||||||
- name: Set the value
|
- 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.
|
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:
|
The expected syntax for the heredoc style is:
|
||||||
|
|
||||||
```
|
```
|
||||||
{VARIABLE_NAME}<<{DELIMETER}
|
{VARIABLE_NAME}<<{DELIMETER}
|
||||||
{VARIABLE_VALUE}
|
{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}`;
|
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:
|
This is wrapped by the core addPath method:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
export function addPath(inputPath: string): void {}
|
export function addPath(inputPath: string): void {}
|
||||||
```
|
```
|
||||||
|
@ -190,6 +196,7 @@ export function addPath(inputPath: string): void {}
|
||||||
### Powershell
|
### 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:
|
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:
|
steps:
|
||||||
- run: echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
- run: echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
|
Loading…
Reference in New Issue