Update PowerShell module validation

This commit is contained in:
Kevin Rowlandson 2020-06-30 20:57:43 +01:00
parent 9b13062ca0
commit 5f2cd423a4
No known key found for this signature in database
GPG key ID: F33348ACAE26BE84

View file

@ -57,7 +57,7 @@ function LintCodebase()
else else
# Success # Success
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
echo "Successfully found binary in system" echo "Successfully found binary for [$LINTER_NAME] in system"
echo "Location:[$VALIDATE_INSTALL_CMD]" echo "Location:[$VALIDATE_INSTALL_CMD]"
fi fi
fi fi
@ -67,12 +67,9 @@ function LintCodebase()
############################################################### ###############################################################
if [[ "$FILE_TYPE" == "POWERSHELL" ]]; then if [[ "$FILE_TYPE" == "POWERSHELL" ]]; then
VALIDATE_PSSA_MODULE=$(pwsh -c "(Get-Module -Name PSScriptAnalyzer -ListAvailable | Select-Object -First 1).Name" 2>&1) VALIDATE_PSSA_MODULE=$(pwsh -c "(Get-Module -Name PSScriptAnalyzer -ListAvailable | Select-Object -First 1).Name" 2>&1)
echo "VALIDATE_PSSA_MODULE: $VALIDATE_PSSA_MODULE"
fi
# If module found, ensure Invoke-ScriptAnalyzer command is available # If module found, ensure Invoke-ScriptAnalyzer command is available
if [[ "$VALIDATE_PSSA_MODULE" == "PSScriptAnalyzer" ]]; then if [[ "$VALIDATE_PSSA_MODULE" == "PSScriptAnalyzer" ]]; then
VALIDATE_PSSA_CMD=$(pwsh -c "(Get-Command Invoke-ScriptAnalyzer | Select-Object -First 1).Name" 2>&1) VALIDATE_PSSA_CMD=$(pwsh -c "(Get-Command Invoke-ScriptAnalyzer | Select-Object -First 1).Name" 2>&1)
echo "VALIDATE_PSSA_CMD: $VALIDATE_PSSA_CMD"
fi fi
####################### #######################
@ -85,14 +82,15 @@ function LintCodebase()
############################## ##############################
if [ $ERROR_CODE -ne 0 ]; then if [ $ERROR_CODE -ne 0 ]; then
# Failed # Failed
echo "ERROR! Failed to import [PSScriptAnalyzer] for [$LINTER_NAME] in system!" echo "ERROR! Failed find module [PSScriptAnalyzer] for [$LINTER_NAME] in system!"
echo "ERROR:[PSSA_MODULE $VALIDATE_PSSA_MODULE] [PSSA_CMD $VALIDATE_PSSA_CMD]" echo "ERROR:[PSSA_MODULE $VALIDATE_PSSA_MODULE] [PSSA_CMD $VALIDATE_PSSA_CMD]"
exit 1 exit 1
else else
# Success # Success
if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then
echo "Successfully imported module [$VALIDATE_PSSA_MODULE]" echo "Successfully found module [$VALIDATE_PSSA_MODULE] in system"
echo "Successfully found command in system [$VALIDATE_PSSA_CMD]" echo "Successfully found command [$VALIDATE_PSSA_CMD] in system"
fi
fi fi
fi fi