Add PowerShell dependency to winget manifests#1497
Conversation
Modify the winget workflow to inject a PowerShell >= 7.0.0 dependency into the installer manifest before submission. This ensures users have PowerShell 7+ installed when installing via winget. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR modifies the winget workflow to add a PowerShell 7.0+ dependency to the installer manifests before submission to the WinGet community repository. This ensures that users installing GitHub Copilot or GitHub Copilot Prerelease via winget will have the required PowerShell version.
Changes:
- Modified wingetcreate to output manifests to a directory instead of submitting directly
- Added PowerShell script to inject a Dependencies.PackageDependencies block with Microsoft.PowerShell >= 7.0.0 into the installer YAML using regex-based string replacement
- Submit the modified manifest to winget repository
Comments suppressed due to low confidence (1)
.github/workflows/winget.yml:60
- The submit command doesn't verify that the manifest modification was successful or that the resulting YAML is valid. If the regex replacement fails or produces malformed YAML, wingetcreate submit will fail. Consider adding validation of the modified manifest before submission, such as checking that the file can be parsed as valid YAML or that wingetcreate can validate it.
.\wingetcreate.exe submit manifests
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a728ae7 to
8d7e467
Compare
- Add check for missing installer manifest with error message - Remove -NoNewline to preserve YAML file conventions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Re-applies the change from PR #1497 which was reverted in PR #1548. The original broke the workflow YAML because the PowerShell here-string content and closing tag had zero indentation, which terminated the YAML literal block scalar (run: |). Fixed by indenting the here-string body to match the block indentation level; YAML strips the leading spaces, leaving valid PowerShell with the closing tag at column 0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Re-applies the change from PR #1497 which was reverted in PR #1548. The original broke the workflow YAML because the PowerShell here-string content and closing tag had zero indentation, which terminated the YAML literal block scalar (run: |). Fixed by indenting the here-string body to match the block indentation level; YAML strips the leading spaces, leaving valid PowerShell with the closing tag at column 0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@SteveSandersonMS - This actually shouldn't be necessary, as wingetcreate should use the latest manifest from Winget-pkgs as the basis for all future manifest submissions. Since the latest manifest has the PowerShell dependency already, the workflow modifications adding the dependency are redundant - and the manual parsing could be flaky if the underlying content ever changes cc @mdanish-kh / @denelon |
This PR modifies the winget workflow to inject a PowerShell >= 7.0.0 package dependency into the installer manifest before submission.
Changes
Dependencies.PackageDependenciesblock withMicrosoft.PowerShell >= 7.0.0into the installer YAMLThis ensures users installing via
winget install GitHub.Copilotorwinget install GitHub.Copilot.Prereleasewill have PowerShell 7+ as a dependency.Reference: microsoft/winget-pkgs#335848. Note that this didn't work because it only affected a single version. I had been under the impression that extra manifest content was preserved across versions but they were not. Seems we have to change the manifest before we submit it.