PowerShell / PowerShell/PSScriptAnalyzer

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

Aperta
#2,205 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C#
Stelle
2.2k
Fork
414
Merge medio
13h 1m
PR unite (30g)
2

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia confrontando l’esecuzione fallita collegata del workflow Ubuntu-latest con PSScriptAnalyzer 1.25 con l’esecuzione funzionante con 1.24; il report indica che l’unica modifica è la versione fissata. Riproduci l’analisi su un progetto PowerShell 7 e determina perché 1.25 non riesce a risolvere Get-Command. Il lavoro è completato quando l’analisi con 1.25 termina correttamente nello stesso workflow senza tornare a 1.24.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
github-actions, powershell, ubuntu
Ambito
ci-cd
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.