Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actions: Add section about group/ungroup commands #482

Merged
merged 8 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/images/actions-log-group.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 38 additions & 17 deletions content/actions/reference/workflow-commands-for-github-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ You can use the `set-output` command in your workflow to set the same value:

The following table shows which toolkit functions are available within a workflow:

| Toolkit function| Equivalent workflow command|
| ------------- | ------------- |
| `core.addPath` | {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}Accessible using environment file `GITHUB_PATH`{% else %} `add-path` {% endif %} |
| `core.debug` | `debug` |
| `core.error` | `error` |
| `core.endGroup` | `endgroup` |
| `core.exportVariable` | {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}Accessible using environment file `GITHUB_ENV`{% else %} `set-env` {% endif %} |
| `core.getInput` | Accessible using environment variable `INPUT_{NAME}` |
| `core.getState` | Accessible using environment variable `STATE_{NAME}` |
| `core.isDebug` | Accessible using environment variable `RUNNER_DEBUG` |
| `core.saveState` | `save-state` |
| `core.setFailed` | Used as a shortcut for `::error` and `exit 1` |
| `core.setOutput` | `set-output` |
| `core.setSecret` | `add-mask` |
| `core.startGroup` | `group` |
| `core.warning` | `warning file` |
| Toolkit function | Equivalent workflow command |
| ----------------- | ------------- |
| `core.addPath` | {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}Accessible using environment file `GITHUB_PATH`{% else %} `add-path` {% endif %} |
| `core.debug` | `debug` |
| `core.error` | `error` |
| `core.endGroup` | `endgroup` |
| `core.exportVariable` | {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}Accessible using environment file `GITHUB_ENV`{% else %} `set-env` {% endif %} |
| `core.getInput` | Accessible using environment variable `INPUT_{NAME}` |
| `core.getState` | Accessible using environment variable `STATE_{NAME}` |
| `core.isDebug` | Accessible using environment variable `RUNNER_DEBUG` |
| `core.saveState` | `save-state` |
| `core.setFailed` | Used as a shortcut for `::error` and `exit 1` |
| `core.setOutput` | `set-output` |
| `core.setSecret` | `add-mask` |
| `core.startGroup` | `group` |
| `core.warning` | `warning file` |

{% if currentVersion ver_lt "enterprise-server@2.23" %}
### Setting an environment variable
Expand Down Expand Up @@ -158,6 +158,25 @@ Creates an error message and prints the message to the log. You can optionally p
echo "::error file=app.js,line=10,col=15::Something went wrong"
```

### Grouping log lines

```
::group::{title}
::endgroup::
```

Emitting a `group` with a title will instruct the logs to create a collapsible region up to the next `endgroup` command.
rachmari marked this conversation as resolved.
Show resolved Hide resolved

#### Example

```bash
echo "::group::My title"
echo "Inside group"
echo "::endgroup::"
```

![Foldable group in workflow run log](/assets/images/actions-log-group.png)

### Masking a value in log

`::add-mask::{value}`
Expand Down Expand Up @@ -254,6 +273,7 @@ echo "action_state=yellow" >> $GITHUB_ENV
Running `$action_state` in a future step will now return `yellow`

#### Multline strings

For multiline strings, you may use a delimiter with the following syntax.

```
Expand All @@ -262,7 +282,8 @@ For multiline strings, you may use a delimiter with the following syntax.
{delimiter}
```

#### Example
##### Example

In this example, we use `EOF` as a delimiter and set the `JSON_RESPONSE` environment variable to the value of the curl response.
```
steps:
Expand Down