diff --git a/content/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions.md b/content/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions.md index 6e86da7b1a29..b708f33886de 100644 --- a/content/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions.md +++ b/content/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions.md @@ -628,7 +628,7 @@ jobs: steps: - shell: pwsh run: | - "mypath" | Out-File -FilePath $env:GITHUB_PATH -Append + "mypath" >> $env:GITHUB_PATH ``` {% endnote %} @@ -652,7 +652,7 @@ echo "{environment_variable_name}={value}" >> "$GITHUB_ENV" * Using PowerShell version 6 and higher: ```powershell copy - "{environment_variable_name}={value}" | Out-File -FilePath $env:GITHUB_ENV -Append + "{environment_variable_name}={value}" >> $env:GITHUB_ENV ``` * Using PowerShell version 5.1 and below: @@ -698,7 +698,7 @@ steps: - name: Set the value id: step_one run: | - "action_state=yellow" | Out-File -FilePath $env:GITHUB_ENV -Append + "action_state=yellow" >> $env:GITHUB_ENV - name: Use the value id: step_two run: | @@ -750,10 +750,10 @@ steps: - name: Set the value in pwsh id: step_one run: | - $EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)}) - "JSON_RESPONSE<<$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append - (Invoke-WebRequest -Uri "https://example.com").Content | Out-File -FilePath $env:GITHUB_ENV -Append - "$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append + $EOF = (New-Guid).Guid + "JSON_RESPONSE<<$EOF" >> $env:GITHUB_ENV + (Invoke-WebRequest -Uri "https://example.com").Content >> $env:GITHUB_ENV + "$EOF" >> $env:GITHUB_ENV shell: pwsh ``` @@ -774,7 +774,7 @@ echo "{name}={value}" >> "$GITHUB_OUTPUT" {% powershell %} ```powershell copy -"{name}=value" | Out-File -FilePath $env:GITHUB_OUTPUT -Append +"{name}=value" >> $env:GITHUB_OUTPUT ``` {% endpowershell %} @@ -805,7 +805,7 @@ This example demonstrates how to set the `SELECTED_COLOR` output parameter and l - name: Set color id: color-selector run: | - "SELECTED_COLOR=green" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + "SELECTED_COLOR=green" >> $env:GITHUB_OUTPUT - name: Get color env:{% raw %} SELECTED_COLOR: ${{ steps.color-selector.outputs.SELECTED_COLOR }}{% endraw %} @@ -827,7 +827,7 @@ echo "{markdown content}" >> $GITHUB_STEP_SUMMARY {% powershell %} ```powershell copy -"{markdown content}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append +"{markdown content}" >> $env:GITHUB_STEP_SUMMARY ``` {% endpowershell %} @@ -851,7 +851,7 @@ echo "### Hello world! :rocket:" >> $GITHUB_STEP_SUMMARY {% powershell %} ```powershell copy -"### Hello world! :rocket:" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append +"### Hello world! :rocket:" >> $env:GITHUB_STEP_SUMMARY ``` {% endpowershell %} @@ -883,11 +883,11 @@ For multiline Markdown content, you can use `>>` to continuously append content ```yaml - name: Generate list using Markdown run: | - "This is the lead in sentence for the list" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append - "" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append # this is a blank line - "- Lets add a bullet point" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append - "- Lets add a second bullet point" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append - "- How about a third one?" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append + "This is the lead in sentence for the list" >> $env:GITHUB_STEP_SUMMARY + "" >> $env:GITHUB_STEP_SUMMARY # this is a blank line + "- Lets add a bullet point" >> $env:GITHUB_STEP_SUMMARY + "- Lets add a second bullet point" >> $env:GITHUB_STEP_SUMMARY + "- How about a third one?" >> $env:GITHUB_STEP_SUMMARY ``` {% endpowershell %} @@ -914,8 +914,8 @@ To clear all content for the current step, you can use `>` to overwrite any prev ```yaml - name: Overwrite Markdown run: | - "Adding some Markdown content" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append - "There was an error, we need to clear the previous Markdown with some new content." | Out-File -FilePath $env:GITHUB_STEP_SUMMARY + "Adding some Markdown content" >> $env:GITHUB_STEP_SUMMARY + "There was an error, we need to clear the previous Markdown with some new content." >> $env:GITHUB_STEP_SUMMARY ``` {% endpowershell %} @@ -942,7 +942,7 @@ To completely remove a summary for the current step, the file that `GITHUB_STEP_ ```yaml - name: Delete all summary content run: | - "Adding Markdown content that we want to remove before the step ends" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append + "Adding Markdown content that we want to remove before the step ends" >> $env:GITHUB_STEP_SUMMARY Remove-Item $env:GITHUB_STEP_SUMMARY ```