Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update pwsh commands #34253

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@

{% endpowershell %}

![Screenshot of the log for the workflow step. The second line, "My title", is prefaced by a downward arrow, indicating an expanded group. The next line, "Inside group", is indented below.](/assets/images/help/actions/actions-log-group.png)

Check warning on line 266 in content/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions.md

View workflow job for this annotation

GitHub Actions / lint-content

Images alternate text should be between 40-150 characters

Image alternate text is 186 characters long.

## Masking a value in a log

Expand Down Expand Up @@ -628,7 +628,7 @@
steps:
- shell: pwsh
run: |
"mypath" | Out-File -FilePath $env:GITHUB_PATH -Append
"mypath" >> $env:GITHUB_PATH
```
nguyenalex836 marked this conversation as resolved.
Show resolved Hide resolved

{% endnote %}
Expand All @@ -652,7 +652,7 @@
* 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:
Expand Down Expand Up @@ -698,7 +698,7 @@
- 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: |
Expand Down Expand Up @@ -750,10 +750,10 @@
- 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
```

Expand All @@ -774,7 +774,7 @@
{% powershell %}

```powershell copy
"{name}=value" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
"{name}=value" >> $env:GITHUB_OUTPUT
```

{% endpowershell %}
Expand Down Expand Up @@ -805,7 +805,7 @@
- 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 %}
Expand All @@ -827,7 +827,7 @@
{% powershell %}

```powershell copy
"{markdown content}" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
"{markdown content}" >> $env:GITHUB_STEP_SUMMARY
```

{% endpowershell %}
Expand All @@ -851,7 +851,7 @@
{% powershell %}

```powershell copy
"### Hello world! :rocket:" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Append
"### Hello world! :rocket:" >> $env:GITHUB_STEP_SUMMARY
```

{% endpowershell %}
Expand Down Expand Up @@ -883,11 +883,11 @@
```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 %}
Expand All @@ -914,8 +914,8 @@
```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 %}
Expand All @@ -942,7 +942,7 @@
```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
```

Expand Down
Loading