From 515fcfe0c05b04ef6efda8c78ef02cb8025bc762 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Fri, 11 Feb 2022 16:52:34 +0100 Subject: [PATCH 01/20] WIP: Adds the raw powershell equivalents. --- .../workflow-commands-for-github-actions.md | 144 +++++++++++++++++- 1 file changed, 137 insertions(+), 7 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index d9c7e21aa1..89dd07ff33 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -26,10 +26,14 @@ Actions can communicate with the runner machine to set environment variables, ou Most workflow commands use the `echo` command in a specific format, while others are invoked by writing to a file. For more information, see ["Environment files".](#environment-files) -``` bash +```bash echo "::workflow-command parameter1={data},parameter2={data}::{command value}" ``` +```pwsh +Write-Output "::workflow-command parameter1={data},parameter2={data}::{command value}" +``` + {% note %} **Note:** Workflow command and parameter names are not case-sensitive. @@ -62,6 +66,16 @@ You can use the `set-output` command in your workflow to set the same value: ``` {% endraw %} +{% raw %} +``` yaml + - name: Set selected color + run: Write-Output "::set-output name=SELECTED_COLOR::green" + id: random-color-generator + - name: Get color + run: Write-Output "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}" +``` +{% endraw %} + The following table shows which toolkit functions are available within a workflow: | Toolkit function | Equivalent workflow command | @@ -95,10 +109,14 @@ Optionally, you can also declare output parameters in an action's metadata file. ### Example -``` bash +```bash echo "::set-output name=action_fruit::strawberry" ``` +```pwsh +Write-Output "::set-output name=action_fruit::strawberry" +``` + ## Setting a debug message ``` @@ -109,10 +127,14 @@ Prints a debug message to the log. You must create a secret named `ACTIONS_STEP_ ### Example -``` bash +```bash echo "::debug::Set the Octocat variable" ``` +```pwsh +Write-Output "::debug::Set the Octocat variable" +``` + {% ifversion fpt or ghes > 3.2 or ghae-issue-4929 or ghec %} ## Setting a notice message @@ -127,10 +149,14 @@ Creates a notice message and prints the message to the log. {% data reusables.ac ### Example -``` bash +```bash echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` +```pwsh +Write-Output "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" +``` + {% endif %} ## Setting a warning message @@ -145,10 +171,14 @@ Creates a warning message and prints the message to the log. {% data reusables.a ### Example -``` bash +```bash echo "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` +```pwsh +Write-Output "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" +``` + ## Setting an error message ``` @@ -161,10 +191,14 @@ Creates an error message and prints the message to the log. {% data reusables.ac ### Example -``` bash +```bash echo "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` +```pwsh +Write-Output "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" +``` + ## Grouping log lines ``` @@ -182,6 +216,12 @@ echo "Inside group" echo "::endgroup::" ``` +```pwsh +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 @@ -200,6 +240,10 @@ When you print `"Mona The Octocat"` in the log, you'll see `"***"`. echo "::add-mask::Mona The Octocat" ``` +```bash +Write-Output "::add-mask::Mona The Octocat" +``` + ### Example masking an environment variable When you print the variable `MY_NAME` or the value `"Mona The Octocat"` in the log, you'll see `"***"` instead of `"Mona The Octocat"`. @@ -209,6 +253,11 @@ MY_NAME="Mona The Octocat" echo "::add-mask::$MY_NAME" ``` +```pwsh +$env:MY_NAME="Mona The Octocat" +Write-Output "::add-mask::$env:MY_NAME" +``` + ## Stopping and starting workflow commands `::stop-commands::{endtoken}` @@ -245,6 +294,22 @@ jobs: echo '::warning:: this is a warning again' ``` +```yaml +jobs: + workflow-command-job: + runs-on: ubuntu-latest + steps: + - name: disable workflow commands + run: | + Write-Output '::warning:: this is a warning' + # PowerShell lacks a simple function to create a hash from a string unfortunately. + $stopMarker = New-Guid + Write-Output "::stop-commands::$stopMarker" + Write-Output '::warning:: this will NOT be a warning' + Write-Output "::$stopMarker::" + Write-Output '::warning:: this is a warning again' +``` + {% endraw %} ## Echoing command outputs @@ -278,6 +343,20 @@ jobs: echo '::set-output name=action_echo::disabled' ``` +```yaml +jobs: + workflow-command-job: + runs-on: ubuntu-latest + steps: + - name: toggle workflow command echoing + run: | + write-output "::set-output name=action_echo::disabled" + write-output "::echo::on" + write-output "::set-output name=action_echo::enabled" + write-output "::echo::off" + write-output "::set-output name=action_echo::disabled" +``` + The step above prints the following lines to the log: ``` @@ -323,11 +402,20 @@ jobs: uses: windows-2019 steps: - shell: powershell - run: echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + run: "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ``` Alternatively, you can use PowerShell Core (`shell: pwsh`), which defaults to UTF-8. +```yaml +jobs: + legacy-powershell-example: + uses: windows-2019 + steps: + - shell: pwsh + run: "mypath" >> $env:GITHUB_PATH +``` + {% endwarning %} ## Setting an environment variable @@ -336,6 +424,14 @@ Alternatively, you can use PowerShell Core (`shell: pwsh`), which defaults to UT echo "{environment_variable_name}={value}" >> $GITHUB_ENV ``` +``` pwsh +"{environment_variable_name}={value}" >> $env:GITHUB_ENV +``` + +``` powershell +"{environment_variable_name}={value}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append +``` + You can make an environment variable available to any subsequent steps in a workflow job by defining or updating the environment variable and writing this to the `GITHUB_ENV` environment file. The step that creates or updates the environment variable does not have access to the new value, but all subsequent steps in a job will have access. The names of environment variables are case-sensitive, and you can include punctuation. For more information, see "[Environment variables](/actions/learn-github-actions/environment-variables)." ### Example @@ -354,6 +450,20 @@ steps: ``` {% endraw %} +{% raw %} +``` +steps: + - name: Set the value + id: step_one + run: | + "action_state=yellow" >> $env:GITHUB_ENV + - name: Use the value + id: step_two + run: | + Write-Output "${{ env.action_state }}" # This will output 'yellow' +``` +{% endraw %} + ### Multiline strings For multiline strings, you may use a delimiter with the following syntax. @@ -377,12 +487,27 @@ steps: echo 'EOF' >> $GITHUB_ENV ``` +```yaml +steps: + - name: Set the value + id: step_one + run: | + "JSON_RESPONSE<> $env:GITHUB_ENV + (Invoke-WebRequest -Uri "google.com").Content >> $env:GITHUB_ENV + "EOF" >> $env:GITHUB_ENV + shell: pwsh +``` + ## Adding a system path ``` bash echo "{path}" >> $GITHUB_PATH ``` +``` pwsh +"{path}" >> $env:GITHUB_PATH +``` + Prepends a directory to the system `PATH` variable and automatically makes it available to all subsequent actions in the current job; the currently running action cannot access the updated path variable. To see the currently defined paths for your job, you can use `echo "$PATH"` in a step or an action. ### Example @@ -392,3 +517,8 @@ This example demonstrates how to add the user `$HOME/.local/bin` directory to `P ``` bash echo "$HOME/.local/bin" >> $GITHUB_PATH ``` + +This example demonstrates how to add the user `$env:HOMEPATH/.local/bin` directory to `PATH`: +``` pwsh +"$env:HOMEPATH/.local/bin" >> $env:GITHUB_PATH +``` \ No newline at end of file From bc371b6c41d65087bfe6efb168883daf6a3c18fe Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Fri, 11 Feb 2022 17:27:29 +0100 Subject: [PATCH 02/20] Corrected snippet type --- .../using-workflows/workflow-commands-for-github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 89dd07ff33..4d50013ef6 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -240,7 +240,7 @@ When you print `"Mona The Octocat"` in the log, you'll see `"***"`. echo "::add-mask::Mona The Octocat" ``` -```bash +```pwsh Write-Output "::add-mask::Mona The Octocat" ``` From 76051b0e6263e4de4ed441027224c91b75f72299 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Mon, 14 Feb 2022 12:31:35 +1000 Subject: [PATCH 03/20] Testing presentation options --- .../workflow-commands-for-github-actions.md | 174 +++++++++--------- 1 file changed, 89 insertions(+), 85 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 4d50013ef6..08c6e2fdbe 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -26,11 +26,13 @@ Actions can communicate with the runner machine to set environment variables, ou Most workflow commands use the `echo` command in a specific format, while others are invoked by writing to a file. For more information, see ["Environment files".](#environment-files) -```bash +### Example + +```bash{:copy} echo "::workflow-command parameter1={data},parameter2={data}::{command value}" ``` -```pwsh +```PowerShell{:copy} Write-Output "::workflow-command parameter1={data},parameter2={data}::{command value}" ``` @@ -50,14 +52,16 @@ Write-Output "::workflow-command parameter1={data},parameter2={data}::{command v The [actions/toolkit](https://github.com/actions/toolkit) includes a number of functions that can be executed as workflow commands. Use the `::` syntax to run the workflow commands within your YAML file; these commands are then sent to the runner over `stdout`. For example, instead of using code to set an output, as below: -```javascript +```javascript{:copy} core.setOutput('SELECTED_COLOR', 'green'); ``` +### Example: Setting a value + You can use the `set-output` command in your workflow to set the same value: {% raw %} -``` yaml +```bash{:copy} - name: Set selected color run: echo '::set-output name=SELECTED_COLOR::green' id: random-color-generator @@ -67,7 +71,7 @@ You can use the `set-output` command in your workflow to set the same value: {% endraw %} {% raw %} -``` yaml +```PowerShell{:copy} - name: Set selected color run: Write-Output "::set-output name=SELECTED_COLOR::green" id: random-color-generator @@ -99,39 +103,39 @@ The following table shows which toolkit functions are available within a workflo ## Setting an output parameter -``` +Sets an action's output parameter. + +```yaml{:copy} ::set-output name={name}::{value} ``` -Sets an action's output parameter. - Optionally, you can also declare output parameters in an action's metadata file. For more information, see "[Metadata syntax for {% data variables.product.prodname_actions %}](/articles/metadata-syntax-for-github-actions#outputs-for-docker-container-and-javascript-actions)." -### Example +### Example: Setting an output parameter -```bash +```bash{:copy} echo "::set-output name=action_fruit::strawberry" ``` -```pwsh +```PowerShell{:copy} Write-Output "::set-output name=action_fruit::strawberry" ``` ## Setting a debug message -``` +Prints a debug message to the log. You must create a secret named `ACTIONS_STEP_DEBUG` with the value `true` to see the debug messages set by this command in the log. For more information, see "[Enabling debug logging](/actions/managing-workflow-runs/enabling-debug-logging)." + +```yaml{:copy} ::debug::{message} ``` -Prints a debug message to the log. You must create a secret named `ACTIONS_STEP_DEBUG` with the value `true` to see the debug messages set by this command in the log. For more information, see "[Enabling debug logging](/actions/managing-workflow-runs/enabling-debug-logging)." +### Example: Setting a debug message -### Example - -```bash +```bash{:copy} echo "::debug::Set the Octocat variable" ``` -```pwsh +```PowerShell{:copy} Write-Output "::debug::Set the Octocat variable" ``` @@ -139,21 +143,21 @@ Write-Output "::debug::Set the Octocat variable" ## Setting a notice message -``` +Creates a notice message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} + +```yaml{:copy} ::notice file={name},line={line},endLine={endLine},title={title}::{message} ``` -Creates a notice message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} - {% data reusables.actions.message-parameters %} -### Example +### Example: Setting a notice message -```bash +```bash{:copy} echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` -```pwsh +```PowerShell{:copy} Write-Output "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` @@ -161,109 +165,109 @@ Write-Output "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ## Setting a warning message -``` +Creates a warning message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} + +```yaml{:copy} ::warning file={name},line={line},endLine={endLine},title={title}::{message} ``` -Creates a warning message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} - {% data reusables.actions.message-parameters %} -### Example +### Example: Setting a warning message -```bash +```bash{:copy} echo "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` -```pwsh +```PowerShell{:copy} Write-Output "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` ## Setting an error message -``` +Creates an error message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} + +```yaml{:copy} ::error file={name},line={line},endLine={endLine},title={title}::{message} ``` -Creates an error message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} - {% data reusables.actions.message-parameters %} -### Example +### Example: Setting an error message -```bash +```bash{:copy} echo "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` -```pwsh +```PowerShell{:copy} Write-Output "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` ## Grouping log lines -``` +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. + +```yaml{:copy} ::group::{title} ::endgroup:: ``` -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. +### Example: Grouping log lines -### Example - -```bash +```bash{:copy} echo "::group::My title" echo "Inside group" echo "::endgroup::" ``` -```pwsh -echo "::group::My title" -echo "Inside group" -echo "::endgroup::" +```PowerShell{:copy} +Write-Output "::group::My title" +Write-Output "Inside group" +Write-Output "::endgroup::" ``` ![Foldable group in workflow run log](/assets/images/actions-log-group.png) ## Masking a value in log -``` +```yaml{:copy} ::add-mask::{value} ``` Masking a value prevents a string or variable from being printed in the log. Each masked word separated by whitespace is replaced with the `*` character. You can use an environment variable or string for the mask's `value`. -### Example masking a string +### Example: Masking a string When you print `"Mona The Octocat"` in the log, you'll see `"***"`. -```bash +```bash{:copy} echo "::add-mask::Mona The Octocat" ``` -```pwsh +```PowerShell{:copy} Write-Output "::add-mask::Mona The Octocat" ``` -### Example masking an environment variable +### Example: Masking an environment variable When you print the variable `MY_NAME` or the value `"Mona The Octocat"` in the log, you'll see `"***"` instead of `"Mona The Octocat"`. -```bash +```bash{:copy} MY_NAME="Mona The Octocat" echo "::add-mask::$MY_NAME" ``` -```pwsh +```PowerShell{:copy} $env:MY_NAME="Mona The Octocat" Write-Output "::add-mask::$env:MY_NAME" ``` ## Stopping and starting workflow commands -`::stop-commands::{endtoken}` - Stops processing any workflow commands. This special command allows you to log anything without accidentally running a workflow command. For example, you could stop logging to output an entire script that has comments. +`::stop-commands::{endtoken}` + To stop the processing of workflow commands, pass a unique token to `stop-commands`. To resume processing workflow commands, pass the same token that you used to stop workflow commands. {% warning %} @@ -272,15 +276,15 @@ To stop the processing of workflow commands, pass a unique token to `stop-comman {% endwarning %} -``` +```yaml{:copy} ::{endtoken}:: ``` -### Example stopping and starting workflow commands +### Example: Stopping and starting workflow commands {% raw %} -```yaml +```yaml{:copy} jobs: workflow-command-job: runs-on: ubuntu-latest @@ -294,7 +298,7 @@ jobs: echo '::warning:: this is a warning again' ``` -```yaml +```yaml{:copy} jobs: workflow-command-job: runs-on: ubuntu-latest @@ -314,22 +318,22 @@ jobs: ## Echoing command outputs -``` +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}`. + +```yaml{:copy} ::echo::on ::echo::off ``` -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}`. - Command echoing is disabled by default. However, a workflow command is echoed if there are any errors processing the command. The `add-mask`, `debug`, `warning`, and `error` commands do not support echoing because their outputs are already echoed to the log. 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. -### Example toggling command echoing +### Example: Toggling command echoing -```yaml +```yaml{:copy} jobs: workflow-command-job: runs-on: ubuntu-latest @@ -343,7 +347,7 @@ jobs: echo '::set-output name=action_echo::disabled' ``` -```yaml +```yaml{:copy} jobs: workflow-command-job: runs-on: ubuntu-latest @@ -359,7 +363,7 @@ jobs: The step above prints the following lines to the log: -``` +```yaml{:copy} ::set-output name=action_echo::enabled ::echo::off ``` @@ -376,13 +380,13 @@ The `save-state` command can only be run within an action, and is not available This example uses JavaScript to run the `save-state` command. The resulting environment variable is named `STATE_processID` with the value of `12345`: -``` javascript +```javascript{:copy} console.log('::save-state name=processID::12345') ``` The `STATE_processID` variable is then exclusively available to the cleanup script running under the `main` action. This example runs in `main` and uses JavaScript to display the value assigned to the `STATE_processID` environment variable: -``` javascript +```javascript{:copy} console.log("The running PID from the main action is: " + process.env.STATE_processID); ``` @@ -390,13 +394,13 @@ console.log("The running PID from the main action is: " + process.env.STATE_pro 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 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. -{% warning %} +{% note %} -**Warning:** On Windows, legacy PowerShell (`shell: powershell`) does not use UTF-8 by default. +**Note:** On Windows, legacy PowerShell (`shell: powershell`) does not use UTF-8 by default. When using `shell: powershell`, you must specify UTF-8 encoding. For example: -```yaml +```PowerShell{:copy} jobs: legacy-powershell-example: uses: windows-2019 @@ -407,7 +411,7 @@ jobs: Alternatively, you can use PowerShell Core (`shell: pwsh`), which defaults to UTF-8. -```yaml +```PowerShell{:copy} jobs: legacy-powershell-example: uses: windows-2019 @@ -416,19 +420,19 @@ jobs: run: "mypath" >> $env:GITHUB_PATH ``` -{% endwarning %} +{% endnote %} ## Setting an environment variable -``` bash +```bash{:copy} echo "{environment_variable_name}={value}" >> $GITHUB_ENV ``` -``` pwsh +```PowerShell{:copy} "{environment_variable_name}={value}" >> $env:GITHUB_ENV ``` -``` powershell +```PowerShell{:copy} "{environment_variable_name}={value}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append ``` @@ -437,7 +441,7 @@ You can make an environment variable available to any subsequent steps in a work ### Example {% raw %} -``` +```yaml{:copy} steps: - name: Set the value id: step_one @@ -451,7 +455,7 @@ steps: {% endraw %} {% raw %} -``` +```yaml{:copy} steps: - name: Set the value id: step_one @@ -468,7 +472,7 @@ steps: For multiline strings, you may use a delimiter with the following syntax. -``` +```yaml{:copy} {name}<<{delimiter} {value} {delimiter} @@ -487,7 +491,7 @@ steps: echo 'EOF' >> $GITHUB_ENV ``` -```yaml +```yaml{:copy} steps: - name: Set the value id: step_one @@ -500,25 +504,25 @@ steps: ## Adding a system path -``` bash +Prepends a directory to the system `PATH` variable and automatically makes it available to all subsequent actions in the current job; the currently running action cannot access the updated path variable. To see the currently defined paths for your job, you can use `echo "$PATH"` in a step or an action. + +```bash{:copy} echo "{path}" >> $GITHUB_PATH ``` -``` pwsh +```PowerShell{:copy} "{path}" >> $env:GITHUB_PATH ``` -Prepends a directory to the system `PATH` variable and automatically makes it available to all subsequent actions in the current job; the currently running action cannot access the updated path variable. To see the currently defined paths for your job, you can use `echo "$PATH"` in a step or an action. - ### Example This example demonstrates how to add the user `$HOME/.local/bin` directory to `PATH`: -``` bash +```bash{:copy} echo "$HOME/.local/bin" >> $GITHUB_PATH ``` This example demonstrates how to add the user `$env:HOMEPATH/.local/bin` directory to `PATH`: -``` pwsh +```PowerShell{:copy} "$env:HOMEPATH/.local/bin" >> $env:GITHUB_PATH -``` \ No newline at end of file +``` From 97265eeaf0c5969de5a36c28ef79c2655d31faa5 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Mon, 14 Feb 2022 12:39:12 +1000 Subject: [PATCH 04/20] Small updates --- .../workflow-commands-for-github-actions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 08c6e2fdbe..b25a34eaaa 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -333,7 +333,7 @@ You can also enable command echoing globally by turning on step debug logging us ### Example: Toggling command echoing -```yaml{:copy} +```bash{:copy} jobs: workflow-command-job: runs-on: ubuntu-latest @@ -347,10 +347,10 @@ jobs: echo '::set-output name=action_echo::disabled' ``` -```yaml{:copy} +```PowerShell{:copy} jobs: workflow-command-job: - runs-on: ubuntu-latest + runs-on: windows-2019 steps: - name: toggle workflow command echoing run: | @@ -361,7 +361,7 @@ jobs: write-output "::set-output name=action_echo::disabled" ``` -The step above prints the following lines to the log: +The example above prints the following lines to the log: ```yaml{:copy} ::set-output name=action_echo::enabled From e5af39e51a73cdec7be2228a8efaa7a828588698 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Mon, 14 Feb 2022 15:17:56 +1000 Subject: [PATCH 05/20] Update workflow-commands-for-github-actions.md --- .../workflow-commands-for-github-actions.md | 50 +++++++++++++------ 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index b25a34eaaa..94ebc82a01 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -215,15 +215,26 @@ Creates an expandable group in the log. To create a group, use the `group` comma ### Example: Grouping log lines ```bash{:copy} -echo "::group::My title" -echo "Inside group" -echo "::endgroup::" +jobs: + bash-example: + runs-on: ubuntu-latest + steps: + - name: Group of log lines + run: | + echo "::group::My title" + echo "Inside group" + echo "::endgroup::" ``` ```PowerShell{:copy} -Write-Output "::group::My title" -Write-Output "Inside group" -Write-Output "::endgroup::" +jobs: + powershell-example: + runs-on: windows-latest + steps: + - name: Group of log lines + run: Write-Output "::group::My title" + Write-Output "Inside group" + Write-Output "::endgroup::" ``` ![Foldable group in workflow run log](/assets/images/actions-log-group.png) @@ -253,13 +264,25 @@ Write-Output "::add-mask::Mona The Octocat" When you print the variable `MY_NAME` or the value `"Mona The Octocat"` in the log, you'll see `"***"` instead of `"Mona The Octocat"`. ```bash{:copy} -MY_NAME="Mona The Octocat" -echo "::add-mask::$MY_NAME" +jobs: + bash-example: + runs-on: ubuntu-latest + env: + MY_NAME: "Mona The Octocat" + steps: + - name: bash-version + run: echo "::add-mask::$MY_NAME" ``` ```PowerShell{:copy} -$env:MY_NAME="Mona The Octocat" -Write-Output "::add-mask::$env:MY_NAME" +jobs: + powershell-example: + runs-on: windows-latest + env: + MY_NAME: "Mona The Octocat" + steps: + - name: powershell-version + run: Write-Output "::add-mask::$env:MY_NAME" ``` ## Stopping and starting workflow commands @@ -306,7 +329,6 @@ jobs: - name: disable workflow commands run: | Write-Output '::warning:: this is a warning' - # PowerShell lacks a simple function to create a hash from a string unfortunately. $stopMarker = New-Guid Write-Output "::stop-commands::$stopMarker" Write-Output '::warning:: this will NOT be a warning' @@ -350,7 +372,7 @@ jobs: ```PowerShell{:copy} jobs: workflow-command-job: - runs-on: windows-2019 + runs-on: windows-latest steps: - name: toggle workflow command echoing run: | @@ -403,7 +425,7 @@ When using `shell: powershell`, you must specify UTF-8 encoding. For example: ```PowerShell{:copy} jobs: legacy-powershell-example: - uses: windows-2019 + uses: windows-latest steps: - shell: powershell run: "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append @@ -414,7 +436,7 @@ Alternatively, you can use PowerShell Core (`shell: pwsh`), which defaults to UT ```PowerShell{:copy} jobs: legacy-powershell-example: - uses: windows-2019 + uses: windows-latest steps: - shell: pwsh run: "mypath" >> $env:GITHUB_PATH From 26695527442881ebc82cc25d3f69449e1c6c15ae Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Tue, 15 Feb 2022 11:57:01 +1000 Subject: [PATCH 06/20] Update workflow-commands-for-github-actions.md --- .../workflow-commands-for-github-actions.md | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 94ebc82a01..8a1d2cba7b 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -418,28 +418,28 @@ During the execution of a workflow, the runner generates temporary files that ca {% note %} -**Note:** On Windows, legacy PowerShell (`shell: powershell`) does not use UTF-8 by default. - -When using `shell: powershell`, you must specify UTF-8 encoding. For example: +**Note:** PowerShell versions 5.1 and below (`shell: powershell`) do not use UTF-8 by default, so you must specify the UTF-8 encoding. For example: ```PowerShell{:copy} jobs: legacy-powershell-example: - uses: windows-latest + runs-on: windows-latest steps: - shell: powershell - run: "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + run: | + echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ``` -Alternatively, you can use PowerShell Core (`shell: pwsh`), which defaults to UTF-8. +PowerShell Core versions 6 and higher (`shell: pwsh`) use UTF-8 by default. For example: ```PowerShell{:copy} jobs: - legacy-powershell-example: - uses: windows-latest + powershell-core-example: + runs-on: windows-latest steps: - shell: pwsh - run: "mypath" >> $env:GITHUB_PATH + run: | + echo "mypath" >> $env:GITHUB_PATH ``` {% endnote %} @@ -502,16 +502,9 @@ For multiline strings, you may use a delimiter with the following syntax. #### Example -In this example, we use `EOF` as a delimiter and set the `JSON_RESPONSE` environment variable to the value of the curl response. -```yaml -steps: - - name: Set the value - id: step_one - run: | - echo 'JSON_RESPONSE<> $GITHUB_ENV - curl https://httpbin.org/json >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV -``` +This example uses `EOF` as a delimiter, and sets the `JSON_RESPONSE` environment variable to the value of the `curl` response. + +The following example demonstrates how to do this in PowerShell Core (version 6 and above): ```yaml{:copy} steps: @@ -519,11 +512,22 @@ steps: id: step_one run: | "JSON_RESPONSE<> $env:GITHUB_ENV - (Invoke-WebRequest -Uri "google.com").Content >> $env:GITHUB_ENV + (Invoke-WebRequest -Uri "https://example.lab").Content >> $env:GITHUB_ENV "EOF" >> $env:GITHUB_ENV shell: pwsh ``` +The following example demonstrates how to do this in PowerShell (version 5.1 and below): + +```yaml +steps: + - name: Set the value + id: step_one + run: | + echo 'JSON_RESPONSE<> $GITHUB_ENV + curl https://example.lab >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV +``` ## Adding a system path Prepends a directory to the system `PATH` variable and automatically makes it available to all subsequent actions in the current job; the currently running action cannot access the updated path variable. To see the currently defined paths for your job, you can use `echo "$PATH"` in a step or an action. From 53947436d33fbd3d1cfbd34eac32c4f8a4227669 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Fri, 25 Feb 2022 13:44:33 +1000 Subject: [PATCH 07/20] Reformatted codeblocks --- .../workflow-commands-for-github-actions.md | 389 ++++++++++-------- 1 file changed, 210 insertions(+), 179 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 8a1d2cba7b..2bba800074 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -28,13 +28,15 @@ Most workflow commands use the `echo` command in a specific format, while others ### Example -```bash{:copy} -echo "::workflow-command parameter1={data},parameter2={data}::{command value}" -``` +- Using Bash: + ```yaml{:copy} + echo "::workflow-command parameter1={data},parameter2={data}::{command value}" + ``` -```PowerShell{:copy} -Write-Output "::workflow-command parameter1={data},parameter2={data}::{command value}" -``` +- Using PowerShell: + ```yaml{:copy} + Write-Output "::workflow-command parameter1={data},parameter2={data}::{command value}" + ``` {% note %} @@ -60,25 +62,27 @@ core.setOutput('SELECTED_COLOR', 'green'); You can use the `set-output` command in your workflow to set the same value: -{% raw %} -```bash{:copy} - - name: Set selected color - run: echo '::set-output name=SELECTED_COLOR::green' - id: random-color-generator - - name: Get color - run: echo "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}" -``` -{% endraw %} +- Using Bash: + {% raw %} + ```yaml{:copy} + - name: Set selected color + run: echo '::set-output name=SELECTED_COLOR::green' + id: random-color-generator + - name: Get color + run: echo "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}" + ``` + {% endraw %} -{% raw %} -```PowerShell{:copy} - - name: Set selected color - run: Write-Output "::set-output name=SELECTED_COLOR::green" - id: random-color-generator - - name: Get color - run: Write-Output "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}" -``` -{% endraw %} +- Using PowerShell: + {% raw %} + ```yaml{:copy} + - name: Set selected color + run: Write-Output "::set-output name=SELECTED_COLOR::green" + id: random-color-generator + - name: Get color + run: Write-Output "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}" + ``` + {% endraw %} The following table shows which toolkit functions are available within a workflow: @@ -113,13 +117,15 @@ Optionally, you can also declare output parameters in an action's metadata file. ### Example: Setting an output parameter -```bash{:copy} -echo "::set-output name=action_fruit::strawberry" -``` +- Using Bash: + ```yaml{:copy} + echo "::set-output name=action_fruit::strawberry" + ``` -```PowerShell{:copy} -Write-Output "::set-output name=action_fruit::strawberry" -``` +- Using PowerShell: + ```yaml{:copy} + Write-Output "::set-output name=action_fruit::strawberry" + ``` ## Setting a debug message @@ -131,13 +137,15 @@ Prints a debug message to the log. You must create a secret named `ACTIONS_STEP_ ### Example: Setting a debug message -```bash{:copy} -echo "::debug::Set the Octocat variable" -``` +- Using Bash: + ```yaml{:copy} + echo "::debug::Set the Octocat variable" + ``` -```PowerShell{:copy} -Write-Output "::debug::Set the Octocat variable" -``` +- Using PowerShell: + ```yaml{:copy} + Write-Output "::debug::Set the Octocat variable" + ``` {% ifversion fpt or ghes > 3.2 or ghae-issue-4929 or ghec %} @@ -153,13 +161,15 @@ Creates a notice message and prints the message to the log. {% data reusables.ac ### Example: Setting a notice message -```bash{:copy} -echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" -``` +- Using Bash: + ```yaml{:copy} + echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" + ``` -```PowerShell{:copy} -Write-Output "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" -``` +- Using PowerShell: + ```yaml{:copy} + Write-Output "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" + ``` {% endif %} @@ -175,13 +185,15 @@ Creates a warning message and prints the message to the log. {% data reusables.a ### Example: Setting a warning message -```bash{:copy} -echo "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" -``` +- Using Bash: + ```yaml{:copy} + echo "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" + ``` -```PowerShell{:copy} -Write-Output "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" -``` +- Using PowerShell: + ```yaml{:copy} + Write-Output "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" + ``` ## Setting an error message @@ -195,13 +207,15 @@ Creates an error message and prints the message to the log. {% data reusables.ac ### Example: Setting an error message -```bash{:copy} -echo "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" -``` +- Using Bash: + ```yaml{:copy} + echo "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" + ``` -```PowerShell{:copy} -Write-Output "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" -``` +- Using PowerShell: + ```yaml{:copy} + Write-Output "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" + ``` ## Grouping log lines @@ -214,28 +228,30 @@ Creates an expandable group in the log. To create a group, use the `group` comma ### Example: Grouping log lines -```bash{:copy} -jobs: - bash-example: - runs-on: ubuntu-latest - steps: - - name: Group of log lines - run: | - echo "::group::My title" - echo "Inside group" - echo "::endgroup::" -``` +- Using Bash: + ```yaml{:copy} + jobs: + bash-example: + runs-on: ubuntu-latest + steps: + - name: Group of log lines + run: | + echo "::group::My title" + echo "Inside group" + echo "::endgroup::" + ``` -```PowerShell{:copy} -jobs: - powershell-example: - runs-on: windows-latest - steps: - - name: Group of log lines - run: Write-Output "::group::My title" - Write-Output "Inside group" - Write-Output "::endgroup::" -``` +- Using PowerShell: + ```yaml{:copy} + jobs: + powershell-example: + runs-on: windows-latest + steps: + - name: Group of log lines + run: Write-Output "::group::My title" + Write-Output "Inside group" + Write-Output "::endgroup::" + ``` ![Foldable group in workflow run log](/assets/images/actions-log-group.png) @@ -251,39 +267,43 @@ Masking a value prevents a string or variable from being printed in the log. Eac When you print `"Mona The Octocat"` in the log, you'll see `"***"`. -```bash{:copy} -echo "::add-mask::Mona The Octocat" -``` +- Using Bash: + ```yaml{:copy} + echo "::add-mask::Mona The Octocat" + ``` -```PowerShell{:copy} -Write-Output "::add-mask::Mona The Octocat" -``` +- Using PowerShell: + ```yaml{:copy} + Write-Output "::add-mask::Mona The Octocat" + ``` ### Example: Masking an environment variable When you print the variable `MY_NAME` or the value `"Mona The Octocat"` in the log, you'll see `"***"` instead of `"Mona The Octocat"`. -```bash{:copy} -jobs: - bash-example: - runs-on: ubuntu-latest - env: - MY_NAME: "Mona The Octocat" - steps: - - name: bash-version - run: echo "::add-mask::$MY_NAME" -``` +- Using Bash: + ```yaml{:copy} + jobs: + bash-example: + runs-on: ubuntu-latest + env: + MY_NAME: "Mona The Octocat" + steps: + - name: bash-version + run: echo "::add-mask::$MY_NAME" + ``` -```PowerShell{:copy} -jobs: - powershell-example: - runs-on: windows-latest - env: - MY_NAME: "Mona The Octocat" - steps: - - name: powershell-version - run: Write-Output "::add-mask::$env:MY_NAME" -``` +- Using PowerShell: + ```yaml{:copy} + jobs: + powershell-example: + runs-on: windows-latest + env: + MY_NAME: "Mona The Octocat" + steps: + - name: powershell-version + run: Write-Output "::add-mask::$env:MY_NAME" + ``` ## Stopping and starting workflow commands @@ -306,35 +326,36 @@ To stop the processing of workflow commands, pass a unique token to `stop-comman ### Example: Stopping and starting workflow commands {% raw %} +- Using bash: + ```yaml{:copy} + jobs: + workflow-command-job: + runs-on: ubuntu-latest + steps: + - name: disable workflow commands + run: | + echo '::warning:: this is a warning' + echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`" + echo '::warning:: this will NOT be a warning' + echo "::`echo -n ${{ github.token }} | sha256sum | head -c 64`::" + echo '::warning:: this is a warning again' + ``` -```yaml{:copy} -jobs: - workflow-command-job: - runs-on: ubuntu-latest - steps: - - name: disable workflow commands - run: | - echo '::warning:: this is a warning' - echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`" - echo '::warning:: this will NOT be a warning' - echo "::`echo -n ${{ github.token }} | sha256sum | head -c 64`::" - echo '::warning:: this is a warning again' -``` - -```yaml{:copy} -jobs: - workflow-command-job: - runs-on: ubuntu-latest - steps: - - name: disable workflow commands - run: | - Write-Output '::warning:: this is a warning' - $stopMarker = New-Guid - Write-Output "::stop-commands::$stopMarker" - Write-Output '::warning:: this will NOT be a warning' - Write-Output "::$stopMarker::" - Write-Output '::warning:: this is a warning again' -``` +- Using PowerShell: + ```yaml{:copy} + jobs: + workflow-command-job: + runs-on: ubuntu-latest + steps: + - name: disable workflow commands + run: | + Write-Output '::warning:: this is a warning' + $stopMarker = New-Guid + Write-Output "::stop-commands::$stopMarker" + Write-Output '::warning:: this will NOT be a warning' + Write-Output "::$stopMarker::" + Write-Output '::warning:: this is a warning again' + ``` {% endraw %} @@ -355,33 +376,35 @@ You can also enable command echoing globally by turning on step debug logging us ### Example: Toggling command echoing -```bash{:copy} -jobs: - workflow-command-job: - runs-on: ubuntu-latest - steps: - - name: toggle workflow command echoing - run: | - echo '::set-output name=action_echo::disabled' - echo '::echo::on' - echo '::set-output name=action_echo::enabled' - echo '::echo::off' - echo '::set-output name=action_echo::disabled' -``` +- Using Bash: + ```yaml{:copy} + jobs: + workflow-command-job: + runs-on: ubuntu-latest + steps: + - name: toggle workflow command echoing + run: | + echo '::set-output name=action_echo::disabled' + echo '::echo::on' + echo '::set-output name=action_echo::enabled' + echo '::echo::off' + echo '::set-output name=action_echo::disabled' + ``` -```PowerShell{:copy} -jobs: - workflow-command-job: - runs-on: windows-latest - steps: - - name: toggle workflow command echoing - run: | - write-output "::set-output name=action_echo::disabled" - write-output "::echo::on" - write-output "::set-output name=action_echo::enabled" - write-output "::echo::off" - write-output "::set-output name=action_echo::disabled" -``` +- Using PowerShell: + ```yaml{:copy} + jobs: + workflow-command-job: + runs-on: windows-latest + steps: + - name: toggle workflow command echoing + run: | + write-output "::set-output name=action_echo::disabled" + write-output "::echo::on" + write-output "::set-output name=action_echo::enabled" + write-output "::echo::off" + write-output "::set-output name=action_echo::disabled" + ``` The example above prints the following lines to the log: @@ -420,7 +443,7 @@ During the execution of a workflow, the runner generates temporary files that ca **Note:** PowerShell versions 5.1 and below (`shell: powershell`) do not use UTF-8 by default, so you must specify the UTF-8 encoding. For example: -```PowerShell{:copy} +```yaml{:copy} jobs: legacy-powershell-example: runs-on: windows-latest @@ -432,7 +455,7 @@ jobs: PowerShell Core versions 6 and higher (`shell: pwsh`) use UTF-8 by default. For example: -```PowerShell{:copy} +```yaml{:copy} jobs: powershell-core-example: runs-on: windows-latest @@ -446,17 +469,20 @@ jobs: ## Setting an environment variable -```bash{:copy} -echo "{environment_variable_name}={value}" >> $GITHUB_ENV -``` +- Using Bash: + ```yaml{:copy} + echo "{environment_variable_name}={value}" >> $GITHUB_ENV + ``` -```PowerShell{:copy} -"{environment_variable_name}={value}" >> $env:GITHUB_ENV -``` +- Using PowerShell version 6 and higher: + ```yaml{:copy} + "{environment_variable_name}={value}" >> $env:GITHUB_ENV + ``` -```PowerShell{:copy} -"{environment_variable_name}={value}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append -``` +- Using PowerShell version 5.1 and below: + ```yaml{:copy} + "{environment_variable_name}={value}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + ``` You can make an environment variable available to any subsequent steps in a workflow job by defining or updating the environment variable and writing this to the `GITHUB_ENV` environment file. The step that creates or updates the environment variable does not have access to the new value, but all subsequent steps in a job will have access. The names of environment variables are case-sensitive, and you can include punctuation. For more information, see "[Environment variables](/actions/learn-github-actions/environment-variables)." @@ -519,7 +545,7 @@ steps: The following example demonstrates how to do this in PowerShell (version 5.1 and below): -```yaml +```yaml{:copy} steps: - name: Set the value id: step_one @@ -532,23 +558,28 @@ steps: Prepends a directory to the system `PATH` variable and automatically makes it available to all subsequent actions in the current job; the currently running action cannot access the updated path variable. To see the currently defined paths for your job, you can use `echo "$PATH"` in a step or an action. -```bash{:copy} -echo "{path}" >> $GITHUB_PATH -``` +- Using Bash: + ```yaml{:copy} + echo "{path}" >> $GITHUB_PATH + ``` -```PowerShell{:copy} -"{path}" >> $env:GITHUB_PATH -``` +- Using PowerShell: + ```yaml{:copy} + "{path}" >> $env:GITHUB_PATH + ``` ### Example This example demonstrates how to add the user `$HOME/.local/bin` directory to `PATH`: -```bash{:copy} -echo "$HOME/.local/bin" >> $GITHUB_PATH -``` +- Using Bash: + ```yaml{:copy} + echo "$HOME/.local/bin" >> $GITHUB_PATH + ``` This example demonstrates how to add the user `$env:HOMEPATH/.local/bin` directory to `PATH`: -```PowerShell{:copy} -"$env:HOMEPATH/.local/bin" >> $env:GITHUB_PATH -``` + +- Using PowerShell: + ```yaml{:copy} + "$env:HOMEPATH/.local/bin" >> $env:GITHUB_PATH + ``` From 1a7217b8795adfa711b97de0137398e96e4c7730 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Fri, 25 Feb 2022 13:28:09 +0100 Subject: [PATCH 08/20] Update workflow-commands-for-github-actions.md --- .../workflow-commands-for-github-actions.md | 163 +++++++++--------- 1 file changed, 85 insertions(+), 78 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 2bba800074..0ff0d843d3 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -29,12 +29,12 @@ Most workflow commands use the `echo` command in a specific format, while others ### Example - Using Bash: - ```yaml{:copy} + ```bash{:copy} echo "::workflow-command parameter1={data},parameter2={data}::{command value}" ``` - Using PowerShell: - ```yaml{:copy} + ```pwsh{:copy} Write-Output "::workflow-command parameter1={data},parameter2={data}::{command value}" ``` @@ -109,7 +109,7 @@ The following table shows which toolkit functions are available within a workflo Sets an action's output parameter. -```yaml{:copy} +```plaintext{:copy} ::set-output name={name}::{value} ``` @@ -118,12 +118,12 @@ Optionally, you can also declare output parameters in an action's metadata file. ### Example: Setting an output parameter - Using Bash: - ```yaml{:copy} + ```bash{:copy} echo "::set-output name=action_fruit::strawberry" ``` - Using PowerShell: - ```yaml{:copy} + ```pwsh{:copy} Write-Output "::set-output name=action_fruit::strawberry" ``` @@ -131,19 +131,19 @@ Optionally, you can also declare output parameters in an action's metadata file. Prints a debug message to the log. You must create a secret named `ACTIONS_STEP_DEBUG` with the value `true` to see the debug messages set by this command in the log. For more information, see "[Enabling debug logging](/actions/managing-workflow-runs/enabling-debug-logging)." -```yaml{:copy} +```plaintext{:copy} ::debug::{message} ``` ### Example: Setting a debug message - Using Bash: - ```yaml{:copy} + ```bash{:copy} echo "::debug::Set the Octocat variable" ``` - Using PowerShell: - ```yaml{:copy} + ```pwsh{:copy} Write-Output "::debug::Set the Octocat variable" ``` @@ -153,7 +153,7 @@ Prints a debug message to the log. You must create a secret named `ACTIONS_STEP_ Creates a notice message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} -```yaml{:copy} +```plaintext{:copy} ::notice file={name},line={line},endLine={endLine},title={title}::{message} ``` @@ -162,12 +162,12 @@ Creates a notice message and prints the message to the log. {% data reusables.ac ### Example: Setting a notice message - Using Bash: - ```yaml{:copy} + ```bash{:copy} echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` - Using PowerShell: - ```yaml{:copy} + ```pwsh{:copy} Write-Output "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` @@ -177,7 +177,7 @@ Creates a notice message and prints the message to the log. {% data reusables.ac Creates a warning message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} -```yaml{:copy} +```plaintext{:copy} ::warning file={name},line={line},endLine={endLine},title={title}::{message} ``` @@ -186,12 +186,12 @@ Creates a warning message and prints the message to the log. {% data reusables.a ### Example: Setting a warning message - Using Bash: - ```yaml{:copy} + ```bash{:copy} echo "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` - Using PowerShell: - ```yaml{:copy} + ```pwsh{:copy} Write-Output "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` @@ -199,7 +199,7 @@ Creates a warning message and prints the message to the log. {% data reusables.a Creates an error message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} -```yaml{:copy} +```plaintext{:copy} ::error file={name},line={line},endLine={endLine},title={title}::{message} ``` @@ -208,12 +208,12 @@ Creates an error message and prints the message to the log. {% data reusables.ac ### Example: Setting an error message - Using Bash: - ```yaml{:copy} + ```bash{:copy} echo "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` - Using PowerShell: - ```yaml{:copy} + ```pwsh{:copy} Write-Output "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` @@ -221,7 +221,7 @@ Creates an error message and prints the message to the log. {% data reusables.ac 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. -```yaml{:copy} +```plaintext{:copy} ::group::{title} ::endgroup:: ``` @@ -248,7 +248,8 @@ Creates an expandable group in the log. To create a group, use the `group` comma runs-on: windows-latest steps: - name: Group of log lines - run: Write-Output "::group::My title" + run: | + Write-Output "::group::My title" Write-Output "Inside group" Write-Output "::endgroup::" ``` @@ -257,7 +258,7 @@ Creates an expandable group in the log. To create a group, use the `group` comma ## Masking a value in log -```yaml{:copy} +```plaintext{:copy} ::add-mask::{value} ``` @@ -268,12 +269,12 @@ Masking a value prevents a string or variable from being printed in the log. Eac When you print `"Mona The Octocat"` in the log, you'll see `"***"`. - Using Bash: - ```yaml{:copy} + ```bash{:copy} echo "::add-mask::Mona The Octocat" ``` - Using PowerShell: - ```yaml{:copy} + ```pwsh{:copy} Write-Output "::add-mask::Mona The Octocat" ``` @@ -309,7 +310,9 @@ When you print the variable `MY_NAME` or the value `"Mona The Octocat"` in the l Stops processing any workflow commands. This special command allows you to log anything without accidentally running a workflow command. For example, you could stop logging to output an entire script that has comments. -`::stop-commands::{endtoken}` +```plaintext{:copy} +::stop-commands::{endtoken} +``` To stop the processing of workflow commands, pass a unique token to `stop-commands`. To resume processing workflow commands, pass the same token that you used to stop workflow commands. @@ -319,7 +322,7 @@ To stop the processing of workflow commands, pass a unique token to `stop-comman {% endwarning %} -```yaml{:copy} +```plaintext{:copy} ::{endtoken}:: ``` @@ -363,7 +366,7 @@ To stop the processing of workflow commands, pass a unique token to `stop-comman 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}`. -```yaml{:copy} +```plaintext{:copy} ::echo::on ::echo::off ``` @@ -376,7 +379,7 @@ You can also enable command echoing globally by turning on step debug logging us ### Example: Toggling command echoing -- Using Bash: +- Using bash: ```yaml{:copy} jobs: workflow-command-job: @@ -408,7 +411,7 @@ You can also enable command echoing globally by turning on step debug logging us The example above prints the following lines to the log: -```yaml{:copy} +```plaintext{:copy} ::set-output name=action_echo::enabled ::echo::off ``` @@ -450,7 +453,7 @@ jobs: steps: - shell: powershell run: | - echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ``` PowerShell Core versions 6 and higher (`shell: pwsh`) use UTF-8 by default. For example: @@ -462,25 +465,25 @@ jobs: steps: - shell: pwsh run: | - echo "mypath" >> $env:GITHUB_PATH + "mypath" >> $env:GITHUB_PATH ``` {% endnote %} ## Setting an environment variable -- Using Bash: - ```yaml{:copy} +- Using bash: + ```bash{:copy} echo "{environment_variable_name}={value}" >> $GITHUB_ENV ``` - Using PowerShell version 6 and higher: - ```yaml{:copy} + ```pwsh{:copy} "{environment_variable_name}={value}" >> $env:GITHUB_ENV ``` - Using PowerShell version 5.1 and below: - ```yaml{:copy} + ```powershell{:copy} "{environment_variable_name}={value}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append ``` @@ -488,39 +491,42 @@ You can make an environment variable available to any subsequent steps in a work ### Example -{% raw %} -```yaml{:copy} -steps: - - name: Set the value - id: step_one - run: | - echo "action_state=yellow" >> $GITHUB_ENV - - name: Use the value - id: step_two - run: | - echo "${{ env.action_state }}" # This will output 'yellow' -``` -{% endraw %} +- Using bash: + {% raw %} + ```yaml{:copy} + steps: + - name: Set the value + id: step_one + run: | + echo "action_state=yellow" >> $GITHUB_ENV + - name: Use the value + id: step_two + run: | + echo "${{ env.action_state }}" # This will output 'yellow' + ``` + {% endraw %} -{% raw %} -```yaml{:copy} -steps: - - name: Set the value - id: step_one - run: | - "action_state=yellow" >> $env:GITHUB_ENV - - name: Use the value - id: step_two - run: | - Write-Output "${{ env.action_state }}" # This will output 'yellow' -``` -{% endraw %} +- Using PowerShell: + + {% raw %} + ```yaml{:copy} + steps: + - name: Set the value + id: step_one + run: | + "action_state=yellow" >> $env:GITHUB_ENV + - name: Use the value + id: step_two + run: | + Write-Output "${{ env.action_state }}" # This will output 'yellow' + ``` + {% endraw %} ### Multiline strings For multiline strings, you may use a delimiter with the following syntax. -```yaml{:copy} +```plaintext{:copy} {name}<<{delimiter} {value} {delimiter} @@ -530,11 +536,23 @@ For multiline strings, you may use a delimiter with the following syntax. This example uses `EOF` as a delimiter, and sets the `JSON_RESPONSE` environment variable to the value of the `curl` response. +The following example demonstrates how to do this in Bash: + +```yaml{:copy} +steps: + - name: Set the value in bash + id: step_one + run: | + echo 'JSON_RESPONSE<> $GITHUB_ENV + curl https://example.lab >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV +``` + The following example demonstrates how to do this in PowerShell Core (version 6 and above): ```yaml{:copy} steps: - - name: Set the value + - name: Set the value in pwsh id: step_one run: | "JSON_RESPONSE<> $env:GITHUB_ENV @@ -543,28 +561,17 @@ steps: shell: pwsh ``` -The following example demonstrates how to do this in PowerShell (version 5.1 and below): - -```yaml{:copy} -steps: - - name: Set the value - id: step_one - run: | - echo 'JSON_RESPONSE<> $GITHUB_ENV - curl https://example.lab >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV -``` ## Adding a system path Prepends a directory to the system `PATH` variable and automatically makes it available to all subsequent actions in the current job; the currently running action cannot access the updated path variable. To see the currently defined paths for your job, you can use `echo "$PATH"` in a step or an action. -- Using Bash: - ```yaml{:copy} +- Using bash: + ```bash{:copy} echo "{path}" >> $GITHUB_PATH ``` - Using PowerShell: - ```yaml{:copy} + ```pwrh{:copy} "{path}" >> $env:GITHUB_PATH ``` @@ -572,14 +579,14 @@ Prepends a directory to the system `PATH` variable and automatically makes it av This example demonstrates how to add the user `$HOME/.local/bin` directory to `PATH`: -- Using Bash: - ```yaml{:copy} +- Using bash: + ```bash{:copy} echo "$HOME/.local/bin" >> $GITHUB_PATH ``` This example demonstrates how to add the user `$env:HOMEPATH/.local/bin` directory to `PATH`: - Using PowerShell: - ```yaml{:copy} + ```pwsh{:copy} "$env:HOMEPATH/.local/bin" >> $env:GITHUB_PATH ``` From 54b53009afa799c3dd631272567d0e9a531cd163 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Fri, 25 Feb 2022 14:36:27 +0100 Subject: [PATCH 09/20] 1 Typo! one! ONE! ARGH! --- .../using-workflows/workflow-commands-for-github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 0ff0d843d3..e473756fe7 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -571,7 +571,7 @@ Prepends a directory to the system `PATH` variable and automatically makes it av ``` - Using PowerShell: - ```pwrh{:copy} + ```pwsh{:copy} "{path}" >> $env:GITHUB_PATH ``` From bb554793a8ca433afcad551a9a66e23ea951d6c7 Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Fri, 25 Feb 2022 14:52:19 +0100 Subject: [PATCH 10/20] Example was using ubuntu-latest for pwsh --- .../using-workflows/workflow-commands-for-github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index e473756fe7..11c3c7f7f0 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -348,7 +348,7 @@ To stop the processing of workflow commands, pass a unique token to `stop-comman ```yaml{:copy} jobs: workflow-command-job: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: disable workflow commands run: | From 53a274d3c2f38105c9c1460527d0106c304a9554 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Thu, 3 Mar 2022 15:35:41 +1000 Subject: [PATCH 11/20] Added tool picker options for powershell and bash --- components/article/ToolPicker.tsx | 4 + content/README.md | 2 +- .../workflow-commands-for-github-actions.md | 570 +++++++++++------- lib/frontmatter.js | 13 +- lib/liquid-tags/extended-markdown.js | 2 + lib/page.js | 2 + lib/schema-event.js | 15 +- 7 files changed, 371 insertions(+), 237 deletions(-) diff --git a/components/article/ToolPicker.tsx b/components/article/ToolPicker.tsx index f00cb6b966..ede5bed03b 100644 --- a/components/article/ToolPicker.tsx +++ b/components/article/ToolPicker.tsx @@ -20,6 +20,8 @@ const supportedTools = [ 'vscode', 'importer_cli', 'graphql', + 'powershell', + 'bash', ] const toolTitles = { webui: 'Web browser', @@ -30,6 +32,8 @@ const toolTitles = { vscode: 'Visual Studio Code', importer_cli: 'GitHub Enterprise Importer CLI', graphql: 'GraphQL API', + powershell: 'PowerShell', + bash: 'Bash', } as Record // Imperatively modify article content to show only the selected tool diff --git a/content/README.md b/content/README.md index 1f37f95462..de6ce8ba17 100644 --- a/content/README.md +++ b/content/README.md @@ -228,7 +228,7 @@ defaultPlatform: linux ### `defaultTool` - Purpose: Override the initial tool selection for a page, where tool refers to the application the reader is using to work with GitHub (such as GitHub.com's web UI, the GitHub CLI, or GitHub Desktop) or the GitHub APIs (such as cURL or the GitHub CLI). For more information about the tool selector, see [Markup reference for GitHub Docs](../contributing/content-markup-reference.md#tool-tags). If this frontmatter is omitted, then the tool-specific content matching the GitHub web UI is shown by default. If a user has indicated a tool preference (by clicking on a tool tab), then the user's preference will be applied instead of the default value. -- Type: `String`, one of: `webui`, `cli`, `desktop`, `curl`, `codespaces`, `vscode`, `importer_cli`, `graphql`. +- Type: `String`, one of: `webui`, `cli`, `desktop`, `curl`, `codespaces`, `vscode`, `importer_cli`, `graphql`, `powershell`, `bash`. - Optional. ```yaml diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 11c3c7f7f0..079495aab3 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -10,6 +10,7 @@ redirect_from: - /actions/reference/logging-commands-for-github-actions - /actions/reference/workflow-commands-for-github-actions - /actions/learn-github-actions/workflow-commands-for-github-actions +defaultTool: bash versions: fpt: '*' ghes: '*' @@ -28,15 +29,21 @@ Most workflow commands use the `echo` command in a specific format, while others ### Example -- Using Bash: - ```bash{:copy} - echo "::workflow-command parameter1={data},parameter2={data}::{command value}" - ``` +{% bash %} -- Using PowerShell: - ```pwsh{:copy} - Write-Output "::workflow-command parameter1={data},parameter2={data}::{command value}" - ``` +```bash{:copy} +echo "::workflow-command parameter1={data},parameter2={data}::{command value}" +``` + +{% endbash %} + +{% powershell %} + +```pwsh{:copy} +Write-Output "::workflow-command parameter1={data},parameter2={data}::{command value}" +``` + +{% endpowershell %} {% note %} @@ -62,27 +69,33 @@ core.setOutput('SELECTED_COLOR', 'green'); You can use the `set-output` command in your workflow to set the same value: -- Using Bash: - {% raw %} - ```yaml{:copy} - - name: Set selected color - run: echo '::set-output name=SELECTED_COLOR::green' - id: random-color-generator - - name: Get color - run: echo "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}" - ``` - {% endraw %} +{% bash %} -- Using PowerShell: - {% raw %} - ```yaml{:copy} - - name: Set selected color - run: Write-Output "::set-output name=SELECTED_COLOR::green" - id: random-color-generator - - name: Get color - run: Write-Output "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}" - ``` - {% endraw %} +{% raw %} +```yaml{:copy} + - name: Set selected color + run: echo '::set-output name=SELECTED_COLOR::green' + id: random-color-generator + - name: Get color + run: echo "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}" +``` +{% endraw %} + +{% endbash %} + +{% powershell %} + +{% raw %} +```yaml{:copy} + - name: Set selected color + run: Write-Output "::set-output name=SELECTED_COLOR::green" + id: random-color-generator + - name: Get color + run: Write-Output "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}" +``` +{% endraw %} + +{% endpowershell %} The following table shows which toolkit functions are available within a workflow: @@ -117,15 +130,21 @@ Optionally, you can also declare output parameters in an action's metadata file. ### Example: Setting an output parameter -- Using Bash: - ```bash{:copy} - echo "::set-output name=action_fruit::strawberry" - ``` +{% bash %} -- Using PowerShell: - ```pwsh{:copy} - Write-Output "::set-output name=action_fruit::strawberry" - ``` +```bash{:copy} +echo "::set-output name=action_fruit::strawberry" +``` + +{% endbash %} + +{% powershell %} + +```pwsh{:copy} +Write-Output "::set-output name=action_fruit::strawberry" +``` + +{% endpowershell %} ## Setting a debug message @@ -137,15 +156,21 @@ Prints a debug message to the log. You must create a secret named `ACTIONS_STEP_ ### Example: Setting a debug message -- Using Bash: - ```bash{:copy} - echo "::debug::Set the Octocat variable" - ``` +{% bash %} -- Using PowerShell: - ```pwsh{:copy} - Write-Output "::debug::Set the Octocat variable" - ``` +```bash{:copy} +echo "::debug::Set the Octocat variable" +``` + +{% endbash %} + +{% powershell %} + +```pwsh{:copy} +Write-Output "::debug::Set the Octocat variable" +``` + +{% endpowershell %} {% ifversion fpt or ghes > 3.2 or ghae-issue-4929 or ghec %} @@ -161,16 +186,21 @@ Creates a notice message and prints the message to the log. {% data reusables.ac ### Example: Setting a notice message -- Using Bash: - ```bash{:copy} - echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" - ``` +{% bash %} -- Using PowerShell: - ```pwsh{:copy} - Write-Output "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" - ``` +```bash{:copy} +echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" +``` +{% endbash %} + +{% powershell %} + +```pwsh{:copy} +Write-Output "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" +``` + +{% endpowershell %} {% endif %} ## Setting a warning message @@ -185,15 +215,20 @@ Creates a warning message and prints the message to the log. {% data reusables.a ### Example: Setting a warning message -- Using Bash: - ```bash{:copy} - echo "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" - ``` +{% bash %} -- Using PowerShell: - ```pwsh{:copy} - Write-Output "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" - ``` +```bash{:copy} +echo "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" +``` +{% endbash %} + +{% powershell %} + +```pwsh{:copy} +Write-Output "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" +``` + +{% endpowershell %} ## Setting an error message @@ -207,16 +242,21 @@ Creates an error message and prints the message to the log. {% data reusables.ac ### Example: Setting an error message -- Using Bash: - ```bash{:copy} - echo "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" - ``` +{% bash %} -- Using PowerShell: - ```pwsh{:copy} - Write-Output "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" - ``` +```bash{:copy} +echo "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" +``` +{% endbash %} + +{% powershell %} + +```pwsh{:copy} +Write-Output "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" +``` + +{% endpowershell %} ## Grouping log lines 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. @@ -228,31 +268,37 @@ Creates an expandable group in the log. To create a group, use the `group` comma ### Example: Grouping log lines -- Using Bash: - ```yaml{:copy} - jobs: - bash-example: - runs-on: ubuntu-latest - steps: - - name: Group of log lines - run: | - echo "::group::My title" - echo "Inside group" - echo "::endgroup::" - ``` +{% bash %} -- Using PowerShell: - ```yaml{:copy} - jobs: - powershell-example: - runs-on: windows-latest - steps: - - name: Group of log lines - run: | - Write-Output "::group::My title" - Write-Output "Inside group" - Write-Output "::endgroup::" - ``` +```yaml{:copy} +jobs: + bash-example: + runs-on: ubuntu-latest + steps: + - name: Group of log lines + run: | + echo "::group::My title" + echo "Inside group" + echo "::endgroup::" +``` + +{% endbash %} + +{% powershell %} + +```yaml{:copy} +jobs: + powershell-example: + runs-on: windows-latest + steps: + - name: Group of log lines + run: | + Write-Output "::group::My title" + Write-Output "Inside group" + Write-Output "::endgroup::" +``` + +{% endpowershell %} ![Foldable group in workflow run log](/assets/images/actions-log-group.png) @@ -268,43 +314,55 @@ Masking a value prevents a string or variable from being printed in the log. Eac When you print `"Mona The Octocat"` in the log, you'll see `"***"`. -- Using Bash: - ```bash{:copy} - echo "::add-mask::Mona The Octocat" - ``` +{% bash %} -- Using PowerShell: - ```pwsh{:copy} - Write-Output "::add-mask::Mona The Octocat" - ``` +```bash{:copy} +echo "::add-mask::Mona The Octocat" +``` + +{% endbash %} + +{% powershell %} + +```pwsh{:copy} +Write-Output "::add-mask::Mona The Octocat" +``` + +{% endpowershell %} ### Example: Masking an environment variable When you print the variable `MY_NAME` or the value `"Mona The Octocat"` in the log, you'll see `"***"` instead of `"Mona The Octocat"`. -- Using Bash: - ```yaml{:copy} - jobs: - bash-example: - runs-on: ubuntu-latest - env: - MY_NAME: "Mona The Octocat" - steps: - - name: bash-version - run: echo "::add-mask::$MY_NAME" - ``` +{% bash %} -- Using PowerShell: - ```yaml{:copy} - jobs: - powershell-example: - runs-on: windows-latest - env: - MY_NAME: "Mona The Octocat" - steps: - - name: powershell-version - run: Write-Output "::add-mask::$env:MY_NAME" - ``` +```yaml{:copy} +jobs: + bash-example: + runs-on: ubuntu-latest + env: + MY_NAME: "Mona The Octocat" + steps: + - name: bash-version + run: echo "::add-mask::$MY_NAME" +``` + +{% endbash %} + +{% powershell %} + +```yaml{:copy} +jobs: + powershell-example: + runs-on: windows-latest + env: + MY_NAME: "Mona The Octocat" + steps: + - name: powershell-version + run: Write-Output "::add-mask::$env:MY_NAME" +``` + +{% endpowershell %} ## Stopping and starting workflow commands @@ -328,40 +386,48 @@ To stop the processing of workflow commands, pass a unique token to `stop-comman ### Example: Stopping and starting workflow commands -{% raw %} -- Using bash: - ```yaml{:copy} - jobs: - workflow-command-job: - runs-on: ubuntu-latest - steps: - - name: disable workflow commands - run: | - echo '::warning:: this is a warning' - echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`" - echo '::warning:: this will NOT be a warning' - echo "::`echo -n ${{ github.token }} | sha256sum | head -c 64`::" - echo '::warning:: this is a warning again' - ``` +{% bash %} -- Using PowerShell: - ```yaml{:copy} - jobs: - workflow-command-job: - runs-on: windows-latest - steps: - - name: disable workflow commands - run: | - Write-Output '::warning:: this is a warning' - $stopMarker = New-Guid - Write-Output "::stop-commands::$stopMarker" - Write-Output '::warning:: this will NOT be a warning' - Write-Output "::$stopMarker::" - Write-Output '::warning:: this is a warning again' - ``` +{% raw %} + +```yaml{:copy} +jobs: + workflow-command-job: + runs-on: ubuntu-latest + steps: + - name: disable workflow commands + run: | + echo '::warning:: this is a warning' + echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`" + echo '::warning:: this will NOT be a warning' + echo "::`echo -n ${{ github.token }} | sha256sum | head -c 64`::" + echo '::warning:: this is a warning again' +``` +{% endraw %} + +{% endbash %} + +{% powershell %} + +{% raw %} +```yaml{:copy} +jobs: + workflow-command-job: + runs-on: windows-latest + steps: + - name: disable workflow commands + run: | + Write-Output '::warning:: this is a warning' + $stopMarker = New-Guid + Write-Output "::stop-commands::$stopMarker" + Write-Output '::warning:: this will NOT be a warning' + Write-Output "::$stopMarker::" + Write-Output '::warning:: this is a warning again' +``` {% endraw %} +{% endpowershell %} ## Echoing command outputs 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}`. @@ -379,35 +445,41 @@ You can also enable command echoing globally by turning on step debug logging us ### Example: Toggling command echoing -- Using bash: - ```yaml{:copy} - jobs: - workflow-command-job: - runs-on: ubuntu-latest - steps: - - name: toggle workflow command echoing - run: | - echo '::set-output name=action_echo::disabled' - echo '::echo::on' - echo '::set-output name=action_echo::enabled' - echo '::echo::off' - echo '::set-output name=action_echo::disabled' - ``` +{% bash %} -- Using PowerShell: - ```yaml{:copy} - jobs: - workflow-command-job: - runs-on: windows-latest - steps: - - name: toggle workflow command echoing - run: | - write-output "::set-output name=action_echo::disabled" - write-output "::echo::on" - write-output "::set-output name=action_echo::enabled" - write-output "::echo::off" - write-output "::set-output name=action_echo::disabled" - ``` +```yaml{:copy} +jobs: + workflow-command-job: + runs-on: ubuntu-latest + steps: + - name: toggle workflow command echoing + run: | + echo '::set-output name=action_echo::disabled' + echo '::echo::on' + echo '::set-output name=action_echo::enabled' + echo '::echo::off' + echo '::set-output name=action_echo::disabled' +``` + +{% endbash %} + +{% powershell %} + +```yaml{:copy} +jobs: + workflow-command-job: + runs-on: windows-latest + steps: + - name: toggle workflow command echoing + run: | + write-output "::set-output name=action_echo::disabled" + write-output "::echo::on" + write-output "::set-output name=action_echo::enabled" + write-output "::echo::off" + write-output "::set-output name=action_echo::disabled" +``` + +{% endpowershell %} The example above prints the following lines to the log: @@ -418,6 +490,8 @@ The example above prints the following lines to the log: 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. + + ## Sending values to the pre and post actions 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. @@ -442,6 +516,8 @@ console.log("The running PID from the main action is: " + process.env.STATE_pro 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 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. +{% powershell %} + {% note %} **Note:** PowerShell versions 5.1 and below (`shell: powershell`) do not use UTF-8 by default, so you must specify the UTF-8 encoding. For example: @@ -470,57 +546,71 @@ jobs: {% endnote %} +{% endpowershell %} + ## Setting an environment variable -- Using bash: - ```bash{:copy} - echo "{environment_variable_name}={value}" >> $GITHUB_ENV - ``` +{% bash %} + +```bash{:copy} +echo "{environment_variable_name}={value}" >> $GITHUB_ENV +``` + +{% endbash %} + +{% powershell %} - Using PowerShell version 6 and higher: - ```pwsh{:copy} - "{environment_variable_name}={value}" >> $env:GITHUB_ENV - ``` +```pwsh{:copy} +"{environment_variable_name}={value}" >> $env:GITHUB_ENV +``` - Using PowerShell version 5.1 and below: - ```powershell{:copy} - "{environment_variable_name}={value}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - ``` +```powershell{:copy} +"{environment_variable_name}={value}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append +``` + +{% endpowershell %} You can make an environment variable available to any subsequent steps in a workflow job by defining or updating the environment variable and writing this to the `GITHUB_ENV` environment file. The step that creates or updates the environment variable does not have access to the new value, but all subsequent steps in a job will have access. The names of environment variables are case-sensitive, and you can include punctuation. For more information, see "[Environment variables](/actions/learn-github-actions/environment-variables)." ### Example -- Using bash: - {% raw %} - ```yaml{:copy} - steps: - - name: Set the value - id: step_one - run: | - echo "action_state=yellow" >> $GITHUB_ENV - - name: Use the value - id: step_two - run: | - echo "${{ env.action_state }}" # This will output 'yellow' - ``` - {% endraw %} +{% bash %} -- Using PowerShell: +{% raw %} +```yaml{:copy} +steps: + - name: Set the value + id: step_one + run: | + echo "action_state=yellow" >> $GITHUB_ENV + - name: Use the value + id: step_two + run: | + echo "${{ env.action_state }}" # This will output 'yellow' +``` +{% endraw %} - {% raw %} - ```yaml{:copy} - steps: - - name: Set the value - id: step_one - run: | - "action_state=yellow" >> $env:GITHUB_ENV - - name: Use the value - id: step_two - run: | - Write-Output "${{ env.action_state }}" # This will output 'yellow' - ``` - {% endraw %} +{% endbash %} + +{% powershell %} + +{% raw %} +```yaml{:copy} +steps: + - name: Set the value + id: step_one + run: | + "action_state=yellow" >> $env:GITHUB_ENV + - name: Use the value + id: step_two + run: | + Write-Output "${{ env.action_state }}" # This will output 'yellow' +``` +{% endraw %} + +{% endpowershell %} ### Multiline strings @@ -565,28 +655,40 @@ steps: Prepends a directory to the system `PATH` variable and automatically makes it available to all subsequent actions in the current job; the currently running action cannot access the updated path variable. To see the currently defined paths for your job, you can use `echo "$PATH"` in a step or an action. -- Using bash: - ```bash{:copy} - echo "{path}" >> $GITHUB_PATH - ``` +{% bash %} -- Using PowerShell: - ```pwsh{:copy} - "{path}" >> $env:GITHUB_PATH - ``` +```bash{:copy} +echo "{path}" >> $GITHUB_PATH +``` +{% endbash %} + +{% powershell %} + +```pwsh{:copy} +"{path}" >> $env:GITHUB_PATH +``` + +{% endpowershell %} ### Example This example demonstrates how to add the user `$HOME/.local/bin` directory to `PATH`: -- Using bash: - ```bash{:copy} - echo "$HOME/.local/bin" >> $GITHUB_PATH - ``` +{% bash %} + +```bash{:copy} +echo "$HOME/.local/bin" >> $GITHUB_PATH +``` + +{% endbash %} + This example demonstrates how to add the user `$env:HOMEPATH/.local/bin` directory to `PATH`: -- Using PowerShell: - ```pwsh{:copy} - "$env:HOMEPATH/.local/bin" >> $env:GITHUB_PATH - ``` +{% powershell %} + +```pwsh{:copy} +"$env:HOMEPATH/.local/bin" >> $env:GITHUB_PATH +``` + +{% endpowershell %} diff --git a/lib/frontmatter.js b/lib/frontmatter.js index 5f8a673ad6..0d14fabc2f 100644 --- a/lib/frontmatter.js +++ b/lib/frontmatter.js @@ -181,7 +181,18 @@ export const schema = { // Tool-specific content preference defaultTool: { type: 'string', - enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode', 'importer_cli', 'graphql'], + enum: [ + 'webui', + 'cli', + 'desktop', + 'curl', + 'codespaces', + 'vscode', + 'importer_cli', + 'graphql', + 'powershell', + 'bash', + ], }, // Documentation contributed by a third party, such as a GitHub Partner contributor: { diff --git a/lib/liquid-tags/extended-markdown.js b/lib/liquid-tags/extended-markdown.js index 507b8b83c2..20eec54659 100644 --- a/lib/liquid-tags/extended-markdown.js +++ b/lib/liquid-tags/extended-markdown.js @@ -10,6 +10,8 @@ export const tags = { vscode: '', importer_cli: '', graphql: '', + powershell: '', + bash: '', all: '', tip: 'border rounded-1 mb-4 p-3 color-border-accent-emphasis color-bg-accent f5', note: 'border rounded-1 mb-4 p-3 color-border-accent-emphasis color-bg-accent f5', diff --git a/lib/page.js b/lib/page.js index 0041c699ab..6e66b4f02e 100644 --- a/lib/page.js +++ b/lib/page.js @@ -294,6 +294,8 @@ class Page { 'vscode', `importer_cli`, `graphql`, + 'powershell', + 'bash', ].filter((tool) => html.includes(`extended-markdown ${tool}`) || html.includes(`tool-${tool}`)) this.includesToolSpecificContent = this.detectedTools.length > 0 diff --git a/lib/schema-event.js b/lib/schema-event.js index 4d4e94a624..ec9564573e 100644 --- a/lib/schema-event.js +++ b/lib/schema-event.js @@ -146,7 +146,18 @@ const context = { }, application_preference: { type: 'string', - enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode', 'importer_cli', 'graphql'], + enum: [ + 'webui', + 'cli', + 'desktop', + 'curl', + 'codespaces', + 'vscode', + 'importer_cli', + 'graphql', + 'powershell', + 'bash', + ], description: 'The application selected by the user.', }, color_mode_preference: { @@ -449,6 +460,8 @@ const preferenceSchema = { 'vscode', 'importer_cli', 'graphql', + 'powershell', + 'bash', 'dark', 'light', 'auto', From 8361e1e627ad0319ff550cb946add470f8001e01 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Thu, 3 Mar 2022 16:49:41 +1000 Subject: [PATCH 12/20] Empty commit for CI From 17ac762d7a414111ecc2e444b1ee0f104cfda0c3 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Fri, 4 Mar 2022 12:46:11 +1000 Subject: [PATCH 13/20] Switched to uuidgen, added clearer example messages --- .../workflow-commands-for-github-actions.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 079495aab3..e115e71d54 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -395,13 +395,14 @@ jobs: workflow-command-job: runs-on: ubuntu-latest steps: - - name: disable workflow commands + - name: Disable workflow commands run: | - echo '::warning:: this is a warning' - echo "::stop-commands::`echo -n ${{ github.token }} | sha256sum | head -c 64`" - echo '::warning:: this will NOT be a warning' - echo "::`echo -n ${{ github.token }} | sha256sum | head -c 64`::" - echo '::warning:: this is a warning again' + echo '::warning:: This is a warning message, to demonstrate that commands are being processed.' + stopMarker=$(uuidgen) + echo "::stop-commands::$stopMarker" + echo '::warning:: This will NOT be rendered as a warning, because stop-commands has been invoked.' + echo "::$stopMarker::" + echo '::warning:: This is a warning again, because stop-commands has been turned off.' ``` {% endraw %} @@ -415,14 +416,14 @@ jobs: workflow-command-job: runs-on: windows-latest steps: - - name: disable workflow commands + - name: Disable workflow commands run: | - Write-Output '::warning:: this is a warning' + Write-Output '::warning:: This is a warning message, to demonstrate that commands are being processed.' $stopMarker = New-Guid Write-Output "::stop-commands::$stopMarker" - Write-Output '::warning:: this will NOT be a warning' + Write-Output '::warning:: This will NOT be rendered as a warning, because stop-commands has been invoked.' Write-Output "::$stopMarker::" - Write-Output '::warning:: this is a warning again' + Write-Output '::warning:: This is a warning again, because stop-commands has been turned off.' ``` {% endraw %} From d0f7d0fb606be27f1756d0d02c14fa184624d855 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Fri, 4 Mar 2022 13:01:00 +1000 Subject: [PATCH 14/20] Update content-markup-reference.md --- contributing/content-markup-reference.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/contributing/content-markup-reference.md b/contributing/content-markup-reference.md index 8d71dffedd..7d8fe5dd2e 100644 --- a/contributing/content-markup-reference.md +++ b/contributing/content-markup-reference.md @@ -196,6 +196,22 @@ These instructions are pertinent to GraphQL API users. {% endgraphql %} ``` +``` +{% powershell %} + +These instructions are pertinent to `pwsh` and `powershell` commands. + +{% endpowershell %} +``` + +``` +{% bash %} + +These instructions are pertinent to Bash shell commands. + +{% endbash %} +``` + You can define a default tool in the frontmatter. For more information, see the [content README](../content/README.md#defaulttool). ## Reusable and variable strings of text From 266e5473448c55cbb6a56f3692fe2365feaf520d Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Fri, 4 Mar 2022 13:05:21 +1000 Subject: [PATCH 15/20] Update workflow-commands-for-github-actions.md --- .../workflow-commands-for-github-actions.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index e115e71d54..e782c47e65 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -627,7 +627,7 @@ For multiline strings, you may use a delimiter with the following syntax. This example uses `EOF` as a delimiter, and sets the `JSON_RESPONSE` environment variable to the value of the `curl` response. -The following example demonstrates how to do this in Bash: +{% bash %} ```yaml{:copy} steps: @@ -639,7 +639,9 @@ steps: echo 'EOF' >> $GITHUB_ENV ``` -The following example demonstrates how to do this in PowerShell Core (version 6 and above): +{% endbash %} + +{% powershell %} ```yaml{:copy} steps: @@ -652,6 +654,8 @@ steps: shell: pwsh ``` +{% endpowershell %} + ## Adding a system path Prepends a directory to the system `PATH` variable and automatically makes it available to all subsequent actions in the current job; the currently running action cannot access the updated path variable. To see the currently defined paths for your job, you can use `echo "$PATH"` in a step or an action. From ae88a1b0af27f2018504ce10ea9175452541849b Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Mon, 7 Mar 2022 14:02:22 +1000 Subject: [PATCH 16/20] Update workflow-commands-for-github-actions.md --- .../workflow-commands-for-github-actions.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index e782c47e65..07d38e4321 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -122,7 +122,7 @@ The following table shows which toolkit functions are available within a workflo Sets an action's output parameter. -```plaintext{:copy} +```{:copy} ::set-output name={name}::{value} ``` @@ -150,7 +150,7 @@ Write-Output "::set-output name=action_fruit::strawberry" Prints a debug message to the log. You must create a secret named `ACTIONS_STEP_DEBUG` with the value `true` to see the debug messages set by this command in the log. For more information, see "[Enabling debug logging](/actions/managing-workflow-runs/enabling-debug-logging)." -```plaintext{:copy} +```{:copy} ::debug::{message} ``` @@ -178,7 +178,7 @@ Write-Output "::debug::Set the Octocat variable" Creates a notice message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} -```plaintext{:copy} +```{:copy} ::notice file={name},line={line},endLine={endLine},title={title}::{message} ``` @@ -207,7 +207,7 @@ Write-Output "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" Creates a warning message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} -```plaintext{:copy} +```{:copy} ::warning file={name},line={line},endLine={endLine},title={title}::{message} ``` @@ -234,7 +234,7 @@ Write-Output "::warning file=app.js,line=1,col=5,endColumn=7::Missing semicolon" Creates an error message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} -```plaintext{:copy} +```{:copy} ::error file={name},line={line},endLine={endLine},title={title}::{message} ``` @@ -261,7 +261,7 @@ Write-Output "::error file=app.js,line=1,col=5,endColumn=7::Missing semicolon" 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. -```plaintext{:copy} +```{:copy} ::group::{title} ::endgroup:: ``` @@ -304,7 +304,7 @@ jobs: ## Masking a value in log -```plaintext{:copy} +```{:copy} ::add-mask::{value} ``` @@ -368,7 +368,7 @@ jobs: Stops processing any workflow commands. This special command allows you to log anything without accidentally running a workflow command. For example, you could stop logging to output an entire script that has comments. -```plaintext{:copy} +```{:copy} ::stop-commands::{endtoken} ``` @@ -380,7 +380,7 @@ To stop the processing of workflow commands, pass a unique token to `stop-comman {% endwarning %} -```plaintext{:copy} +```{:copy} ::{endtoken}:: ``` @@ -433,7 +433,7 @@ jobs: 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}`. -```plaintext{:copy} +```{:copy} ::echo::on ::echo::off ``` @@ -484,7 +484,7 @@ jobs: The example above prints the following lines to the log: -```plaintext{:copy} +```{:copy} ::set-output name=action_echo::enabled ::echo::off ``` @@ -617,7 +617,7 @@ steps: For multiline strings, you may use a delimiter with the following syntax. -```plaintext{:copy} +```{:copy} {name}<<{delimiter} {value} {delimiter} From 3d1de14fc62bfb7a8b9bdb6876581977bc6a982c Mon Sep 17 00:00:00 2001 From: Jesse Houwing Date: Fri, 11 Mar 2022 14:06:03 +0100 Subject: [PATCH 17/20] Update workflow-commands-for-github-actions.md --- .../using-workflows/workflow-commands-for-github-actions.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 07d38e4321..a0304bf2ef 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -429,6 +429,7 @@ jobs: {% endraw %} {% endpowershell %} + ## Echoing command outputs 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}`. @@ -491,8 +492,6 @@ The example above prints the following lines to the log: 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. - - ## Sending values to the pre and post actions 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. From 63978b65ee2978eb62ac0ff605994d93bc3cf550 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Fri, 18 Mar 2022 09:33:40 +1000 Subject: [PATCH 18/20] Update workflow-commands-for-github-actions.md --- .../using-workflows/workflow-commands-for-github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index a0304bf2ef..8943c34c0c 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -376,7 +376,7 @@ To stop the processing of workflow commands, pass a unique token to `stop-comman {% warning %} -**Warning:** Make sure the token you're using is randomly generated and unique for each run. As demonstrated in the example below, you can generate a unique hash of your `github.token` for each run. +**Warning:** Make sure the token you're using is randomly generated and unique for each run. {% endwarning %} From f24a5cb1ebe004912e5352352eec2137b302d786 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Mon, 21 Mar 2022 11:04:34 +1000 Subject: [PATCH 19/20] Update workflow-commands-for-github-actions.md --- .../using-workflows/workflow-commands-for-github-actions.md | 1 - 1 file changed, 1 deletion(-) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index 8943c34c0c..edaa25be79 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -10,7 +10,6 @@ redirect_from: - /actions/reference/logging-commands-for-github-actions - /actions/reference/workflow-commands-for-github-actions - /actions/learn-github-actions/workflow-commands-for-github-actions -defaultTool: bash versions: fpt: '*' ghes: '*' From 09c77faaa1b808ae3c72f969ec1d6aaed3809d84 Mon Sep 17 00:00:00 2001 From: Martin Lopes Date: Mon, 21 Mar 2022 11:19:54 +1000 Subject: [PATCH 20/20] Update workflow-commands-for-github-actions.md --- .../using-workflows/workflow-commands-for-github-actions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/actions/using-workflows/workflow-commands-for-github-actions.md b/content/actions/using-workflows/workflow-commands-for-github-actions.md index edaa25be79..33f4bbdedd 100644 --- a/content/actions/using-workflows/workflow-commands-for-github-actions.md +++ b/content/actions/using-workflows/workflow-commands-for-github-actions.md @@ -2,6 +2,7 @@ title: Workflow commands for GitHub Actions shortTitle: Workflow commands intro: You can use workflow commands when running shell commands in a workflow or in an action's code. +defaultTool: bash redirect_from: - /articles/development-tools-for-github-actions - /github/automating-your-workflow-with-github-actions/development-tools-for-github-actions