Skip to content

Commit 4620400

Browse files
authored
Actions: Add section about group/ungroup commands (#482)
1 parent 0609194 commit 4620400

File tree

2 files changed

+38
-17
lines changed

2 files changed

+38
-17
lines changed

assets/images/actions-log-group.png

4.88 KB
Loading

content/actions/reference/workflow-commands-for-github-actions.md

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@ You can use the `set-output` command in your workflow to set the same value:
6565
6666
The following table shows which toolkit functions are available within a workflow:
6767
68-
| Toolkit function| Equivalent workflow command|
69-
| ------------- | ------------- |
70-
| `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 %} |
71-
| `core.debug` | `debug` |
72-
| `core.error` | `error` |
73-
| `core.endGroup` | `endgroup` |
74-
| `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 %} |
75-
| `core.getInput` | Accessible using environment variable `INPUT_{NAME}` |
76-
| `core.getState` | Accessible using environment variable `STATE_{NAME}` |
77-
| `core.isDebug` | Accessible using environment variable `RUNNER_DEBUG` |
78-
| `core.saveState` | `save-state` |
79-
| `core.setFailed` | Used as a shortcut for `::error` and `exit 1` |
80-
| `core.setOutput` | `set-output` |
81-
| `core.setSecret` | `add-mask` |
82-
| `core.startGroup` | `group` |
83-
| `core.warning` | `warning file` |
68+
| Toolkit function | Equivalent workflow command |
69+
| ----------------- | ------------- |
70+
| `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 %} |
71+
| `core.debug` | `debug` |
72+
| `core.error` | `error` |
73+
| `core.endGroup` | `endgroup` |
74+
| `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 %} |
75+
| `core.getInput` | Accessible using environment variable `INPUT_{NAME}` |
76+
| `core.getState` | Accessible using environment variable `STATE_{NAME}` |
77+
| `core.isDebug` | Accessible using environment variable `RUNNER_DEBUG` |
78+
| `core.saveState` | `save-state` |
79+
| `core.setFailed` | Used as a shortcut for `::error` and `exit 1` |
80+
| `core.setOutput` | `set-output` |
81+
| `core.setSecret` | `add-mask` |
82+
| `core.startGroup` | `group` |
83+
| `core.warning` | `warning file` |
8484

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

163+
### Grouping log lines
164+
165+
```
166+
::group::{title}
167+
::endgroup::
168+
```
169+
170+
Creates an expandable group in the log. To create a group, use the `group` command and specify a `title`. Anything you print to the log between the `group` and `endgroup` commands is nested inside an expandable entry in the log.
171+
172+
#### Example
173+
174+
```bash
175+
echo "::group::My title"
176+
echo "Inside group"
177+
echo "::endgroup::"
178+
```
179+
180+
![Foldable group in workflow run log](/assets/images/actions-log-group.png)
181+
163182
### Masking a value in log
164183

165184
`::add-mask::{value}`
@@ -256,6 +275,7 @@ echo "action_state=yellow" >> $GITHUB_ENV
256275
Running `$action_state` in a future step will now return `yellow`
257276

258277
#### Multline strings
278+
259279
For multiline strings, you may use a delimiter with the following syntax.
260280

261281
```
@@ -264,7 +284,8 @@ For multiline strings, you may use a delimiter with the following syntax.
264284
{delimiter}
265285
```
266286

267-
#### Example
287+
##### Example
288+
268289
In this example, we use `EOF` as a delimiter and set the `JSON_RESPONSE` environment variable to the value of the curl response.
269290
```
270291
steps:

0 commit comments

Comments
 (0)