You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/actions/learn-github-actions/workflow-commands-for-github-actions.md
+42-1Lines changed: 42 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -68,14 +68,15 @@ The following table shows which toolkit functions are available within a workflo
68
68
| ----------------- | ------------- |
69
69
| `core.addPath` | Accessible using environment file `GITHUB_PATH` |
70
70
| `core.debug` | `debug` |{% ifversion fpt or ghes > 3.2 or ghae-issue-4929 or ghec %}
71
-
| `core.notice` | `notice` |{% endif %}
71
+
| `core.notice` | `notice` |{% endif %}
72
72
| `core.error` | `error` |
73
73
| `core.endGroup` | `endgroup` |
74
74
| `core.exportVariable` | Accessible using environment file `GITHUB_ENV` |
75
75
| `core.getInput` | Accessible using environment variable `INPUT_{NAME}` |
76
76
| `core.getState` | Accessible using environment variable `STATE_{NAME}` |
77
77
| `core.isDebug` | Accessible using environment variable `RUNNER_DEBUG` |
78
78
| `core.saveState` | `save-state` |
79
+
| `core.setCommandEcho` | `echo` |
79
80
| `core.setFailed` | Used as a shortcut for `::error` and `exit 1` |
80
81
| `core.setOutput` | `set-output` |
81
82
| `core.setSecret` | `add-mask` |
@@ -246,6 +247,46 @@ jobs:
246
247
247
248
{% endraw %}
248
249
250
+
## Echoing command outputs
251
+
252
+
```
253
+
::echo::on
254
+
::echo::off
255
+
```
256
+
257
+
Enables or disables echoing of workflow commands. For example, if you use the `set-output` command in a workflow, it sets an output parameter but the workflow run's log does not show the command itself. If you enable command echoing, then the log shows the command, such as `::set-output name={name}::{value}`.
258
+
259
+
Command echoing is disabled by default. However, a workflow command is echoed if there are any error occurs processing the command.
260
+
261
+
The `add-mask`, `debug`, `warning`, and `error` commands do not support echoing because their outputs are already echoed to the log.
262
+
263
+
You can also enable command echoing globally by turning on step debug logging using the `ACTIONS_STEP_DEBUG` secret. For more information, see "[Enabling debug logging](/actions/managing-workflow-runs/enabling-debug-logging)". In contrast, the `echo` workflow command lets you enable command echoing at a more granular level, rather than enabling it for every workflow in a repository.
264
+
265
+
### Example toggling command echoing
266
+
267
+
```yaml
268
+
jobs:
269
+
workflow-command-job:
270
+
runs-on: ubuntu-latest
271
+
steps:
272
+
- name: toggle workflow command echoing
273
+
run: |
274
+
echo '::set-output name=action_echo::disabled'
275
+
echo '::echo::on'
276
+
echo '::set-output name=action_echo::enabled'
277
+
echo '::echo::off'
278
+
echo '::set-output name=action_echo::disabled'
279
+
```
280
+
281
+
The step above prints the following lines to the log:
282
+
283
+
```
284
+
::set-output name=action_echo::enabled
285
+
::echo::off
286
+
```
287
+
288
+
Only the second `set-output` and `echo` workflow commands are included in the log because command echoing was only enabled when they were run. Even though it is not always echoed, the output parameter is set in all cases.
289
+
249
290
## Sending values to the pre and post actions
250
291
251
292
You can use the `save-state` command to create environment variables for sharing with your workflow's `pre:` or `post:` actions. For example, you can create a file with the `pre:` action, pass the file location to the `main:` action, and then use the `post:` action to delete the file. Alternatively, you could create a file with the `main:` action, pass the file location to the `post:` action, and also use the `post:` action to delete the file.
0 commit comments