PowerShell / PowerShell/PSScriptAnalyzer

On github actions ubuntu-latest analysis fails with "The term 'Get-Command' is not recognized as a name of a cmdlet"

オープン
#2,205 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
2.2k
フォーク
414
平均マージ
13時間 1分
マージ済み PR(30日)
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、PSScriptAnalyzer 1.25 を使用した、リンク先の失敗した Ubuntu-latest workflow 実行を、1.24 で動作している実行と比較します。レポートでは、唯一の変更点は固定されたバージョンであると示されています。PowerShell 7 プロジェクトに対して分析を再現し、1.25 が Get-Command を解決できない理由を特定します。1.24 に戻さず、同じ workflow 上で 1.25 の分析が正常に完了すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
github-actions, powershell, ubuntu
領域
ci-cd
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。