PowerShell / PowerShell/PSScriptAnalyzer
On github actions ubuntu-latest analysis fails with "The term 'Get-Command' is not recognized as a name of a cmdlet"
還沒有人認領這個 Issue。
- 主要語言
- C#
- 星號
- 2.2k
- 分支
- 415
- 平均合併
- 13 小時 1 分鐘
- 30 天內合併 PR
- 2
描述
I can't exactly pinpoint what causes this. When I run the pwoershell script analyzet 1.25 on Ubuntu-latest github runners against a powershell 7 project, the analyzer fails to complete its analysis and throws:
Invoke-ScriptAnalyzer: /home/runner/work/_temp/e8c5014b-7f61-4956-b6d1-75953a6d07f6.ps1:7
Line |
7 | $results = Invoke-ScriptAnalyzer -Path './' -Recurse -Settings 'PSScr …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The term 'Get-Command' is not recognized as a name of a cmdlet,
| function, script file, or executable program. Check the spelling of the
| name, or if a path was included, verify that the path is correct and try
| again.
Reverting to 1.24 does not exhibit the issue.
Failing workflow run 1.25:
https://github.com/jessehouwing/actions-semver-checker/actions/runs/32254079386/job/96071605798
Working workflow run 1.24:
https://github.com/jessehouwing/actions-semver-checker/actions/runs/32257267058
No changes other than changing the pinned version:
https://github.com/jessehouwing/actions-semver-checker/pull/454
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先比較使用 PSScriptAnalyzer 1.25 的已連結失敗 Ubuntu-latest workflow 執行與使用 1.24 的正常執行;報告指出唯一的變更是固定的版本。針對 PowerShell 7 專案重現該分析,並判定 1.25 無法解析 Get-Command 的原因。在不回復到 1.24 的情況下,如果 1.25 的分析在相同 workflow 上成功完成,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- github-actions, powershell, ubuntu
- 領域
- ci-cd
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 冷清
- 描述清晰度
- 需要釐清
- 新手友好度
- 45/100