docs icon indicating copy to clipboard operation
docs copied to clipboard

Update `pwsh` commands

Open MrHinsh opened this issue 1 year ago • 5 comments

Why:

Currently, in the documentation for workflow-commands-for-github-actions it states that a valid use of PowerShell is:

"$Something" | Out-File -FilePath $env:GITHUB_ENV -Append

However, this does not work for the hosted Ubuntu-Latest agents running with the pwsh shell.

What's being changed:

I have updated all of the powershell commands on this page to be the working format of:

"$Something" >> $env:GITHUB_ENV

Which I have tested produces consistent results.

I have left all older PowerShell commands and only updated the Powershell Core ones.

Check off the following:

  • [ ] I have reviewed my changes in staging, available via the View deployment link in this PR's timeline (this link will be available after opening the PR).

    • For content changes, you will also see an automatically generated comment with links directly to pages you've modified. The comment won't appear if your PR only edits files in the data directory.
  • [x] For content changes, I have completed the self-review checklist.

MrHinsh avatar Aug 08 '24 16:08 MrHinsh

Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

welcome[bot] avatar Aug 08 '24 16:08 welcome[bot]

Automatically generated comment ℹ️

This comment is automatically generated and will be overwritten every time changes are committed to this branch.

The table contains an overview of files in the content directory that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the data directory will not show up in this table.


Content directory changes

You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.

Source Preview Production What Changed
actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions.md fpt
ghec
ghes@ 3.14 3.13 3.12 3.11 3.10
fpt
ghec
ghes@ 3.14 3.13 3.12 3.11 3.10

fpt: Free, Pro, Team ghec: GitHub Enterprise Cloud ghes: GitHub Enterprise Server

github-actions[bot] avatar Aug 08 '24 16:08 github-actions[bot]

@MrHinsh Thanks so much for opening a PR! I'll get this triaged for review ✨

nguyenalex836 avatar Aug 08 '24 17:08 nguyenalex836

Thanks for opening a pull request! We've triaged this issue for technical review by a subject matter expert :eyes:

github-actions[bot] avatar Aug 09 '24 06:08 github-actions[bot]

Why:

Currently, in the documentation for workflow-commands-for-github-actions it states that a valid use of PowerShell is:

"$Something" | Out-File -FilePath $env:GITHUB_ENV -Append

However, this does not work for the hosted Ubuntu-Latest agents running with the pwsh shell.

What's being changed:

I have updated all of the powershell commands on this page to be the working format of:

"$Something" >> $env:GITHUB_ENV

Which I have tested produces consistent results.

I have left all older PowerShell commands and only updated the Powershell Core ones.

Check off the following:

  • [ ] I have reviewed my changes in staging, available via the View deployment link in this PR's timeline (this link will be available after opening the PR).

    • For content changes, you will also see an automatically generated comment with links directly to pages you've modified. The comment won't appear if your PR only edits files in the data directory.
  • [ ] For content changes, I have completed the self-review checklist.

Faiqonli avatar Aug 09 '24 11:08 Faiqonli

@MrHinsh Thank you for your patience while our SME team reviewed your PR! Our SME team responded with the following:

By proposing these changes, won't these commands then not work for windows-latest runners? The doc as-is doesn’t seem to indicate which OS the steps in the doc are for, which might be part of the overall confusion.

If you have any feedback regarding this response, please let us know! 💛

nguyenalex836 avatar Sep 04 '24 20:09 nguyenalex836

I'm positive I've run these as is on Windows agents as well. I'll run a test, but if it works in Powershell it should work in both environments.

MrHinsh avatar Sep 04 '24 22:09 MrHinsh

I'm positive I've run these as is on Windows agents as well. I'll run a test, but if it works in Powershell it should work in both environments.

@MrHinsh Sounds like a plan! Let us know what the results of your test are 💛 CC @subatoi just for 👀

nguyenalex836 avatar Sep 04 '24 22:09 nguyenalex836

This PR has been automatically closed because there has been no response to to our request for more information from the original author. Please reach out if you have the information we requested, or open a new issue to describing your changes. Then we can begin the review process.

github-actions[bot] avatar Sep 11 '24 22:09 github-actions[bot]

How do i reopen this?

MrHinsh avatar Sep 12 '24 06:09 MrHinsh

Apologies about the aggressive automation @MrHinsh

subatoi avatar Sep 12 '24 06:09 subatoi

Ive tested this for both Ubuntu and Windows: https://github.com/MrHinsh/pwsh-command-test/actions/runs/10825655461

I created the following build:

name: Test Setup

on:
  push:
    branches: ["*"]
  workflow_dispatch:

defaults:
  run:
    shell: pwsh

jobs:

   # Setup & Configuration
  SetupWin:
    name: "Windows Test"
    runs-on: windows-latest
    outputs:
      TestSetupWin: ${{ steps.nkdagility.outputs.TestSetupWin }}      
    steps:
    - name: "Build NKDAgility Outputs"
      shell: pwsh
      id: nkdagility
      run: |
            echo "TestSetupWin=sucess" >> $env:GITHUB_OUTPUT

   # Setup & Configuration
  SetupUbntu:
    name: "Ubuntu Test"
    runs-on: ubuntu-latest
    outputs:
      TestSetupUn: ${{ steps.nkdagility.outputs.TestSetupUn }}      
    steps:
    - name: "Build NKDAgility Outputs"
      shell: pwsh
      id: nkdagility
      run: |
            echo "TestSetupUn=sucess" >> $env:GITHUB_OUTPUT


  # Setup Validator
  SetupSummeryStage:
    name: "Results"
    runs-on: ubuntu-latest
    needs: [SetupWin, SetupUbntu]
    steps:
    - name: "Show Summery"
      if: always()
      shell: pwsh
      id: nkdagility-summery
      run: |
            $markdown = @"
                 - TestSetupWin: ${{needs.SetupWin.outputs.TestSetupWin}}
                 - TestSetupUn: ${{needs.SetupUbntu.outputs.TestSetupUn}}
            "@
            echo $markdown >> $Env:GITHUB_STEP_SUMMARY


This build uses echo "TestSetupWin=sucess" >> $env:GITHUB_OUTPUT to set a variable both through ubuntu-latest and through windows-latest with the same results:

image

Please feel free to check my work.

Repo: https://github.com/MrHinsh/pwsh-command-test/ Action: https://github.com/MrHinsh/pwsh-command-test/actions/workflows/main.yml

Result: https://github.com/MrHinsh/pwsh-command-test/actions/runs/10825739503

@nguyenalex836 does this address the concern?

MrHinsh avatar Sep 12 '24 06:09 MrHinsh

@MrHinsh Thank you for testing and posting your results! ✨ I'm going to ping the SME who initially reviewed this PR to review these results as well. We'll provide an update once the review is finished 💛

nguyenalex836 avatar Sep 12 '24 16:09 nguyenalex836

@MrHinsh Our SME just reviewed your results, and everything looks perfect! ✨ Thank you for taking the time to draft this PR and sharing your test results 💛

This repo is currently in a code freeze, but we will get this merged as soon as the freeze ends on 9/16 🍏

nguyenalex836 avatar Sep 12 '24 16:09 nguyenalex836

Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. If you're looking for your next contribution, check out our help wanted issues :zap:

github-actions[bot] avatar Sep 16 '24 15:09 github-actions[bot]