diff --git a/Actions/AL-Go-TestRepoHelper.ps1 b/Actions/AL-Go-TestRepoHelper.ps1 index 38a6e2643..efc05bdf2 100644 --- a/Actions/AL-Go-TestRepoHelper.ps1 +++ b/Actions/AL-Go-TestRepoHelper.ps1 @@ -116,7 +116,22 @@ function Test-JsonFile { Test-JsonStr -org -jsonStr (Get-Content -Path $jsonFile -Raw -Encoding UTF8) -settingsDescription $settingsFile -type $type } -function Test-ALGoRepository { +function TestRunnerPrerequisites { + try { + invoke-gh version + } + catch { + Write-Host "::Warning::GitHub CLI is not installed" + } + try { + invoke-git version + } + catch { + Write-Host "::Warning::Git is not installed" + } +} + +function TestALGoRepository { Param( [string] $baseFolder = $ENV:GITHUB_WORKSPACE ) diff --git a/Actions/Github-Helper.psm1 b/Actions/Github-Helper.psm1 index bbb622738..946ac04d6 100644 --- a/Actions/Github-Helper.psm1 +++ b/Actions/Github-Helper.psm1 @@ -309,18 +309,16 @@ function invoke-gh { $arguments = "$command " foreach($parameter in $remaining) { if ("$parameter".IndexOf(" ") -ge 0 -or "$parameter".IndexOf('"') -ge 0) { + if ($parameter.length -gt 15000) { + $parameter = "$($parameter.Substring(0,15000))...`n`n**Truncated due to size limits!**" + } $arguments += """$($parameter.Replace('"','\"'))"" " } else { $arguments += "$parameter " } } - try { - cmdDo -command gh -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr - } - catch [System.Management.Automation.MethodInvocationException] { - throw "It looks like GitHub CLI is not installed. Please install GitHub CLI from https://cli.github.com/" - } + cmdDo -command gh -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr } } @@ -344,12 +342,7 @@ function invoke-git { $arguments += "$parameter " } } - try { - cmdDo -command git -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr - } - catch [System.Management.Automation.MethodInvocationException] { - throw "It looks like Git is not installed. Please install Git from https://git-scm.com/download" - } + cmdDo -command git -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr } } diff --git a/Actions/WorkflowInitialize/WorkflowInitialize.ps1 b/Actions/WorkflowInitialize/WorkflowInitialize.ps1 index c34d25b65..0f34049df 100644 --- a/Actions/WorkflowInitialize/WorkflowInitialize.ps1 +++ b/Actions/WorkflowInitialize/WorkflowInitialize.ps1 @@ -25,10 +25,12 @@ try { Write-Big -str "a$verstr" - Test-ALGoRepository + TestALGoRepository DownloadAndImportBcContainerHelper + TestRunnerPrerequisites + import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve) $telemetryScope = CreateScope -eventId $eventId if ($telemetryScope) { diff --git a/Tests/WorkflowInitialize.Test.ps1 b/Tests/WorkflowInitialize.Test.ps1 index 4fab4d6f7..3f3c00289 100644 --- a/Tests/WorkflowInitialize.Test.ps1 +++ b/Tests/WorkflowInitialize.Test.ps1 @@ -51,7 +51,7 @@ Describe "WorkflowInitialize Action Tests" { Set-Content -Path (Join-Path $githubFolder 'AL-Go-Settings.json') -Value $repoSettings -Encoding UTF8 Set-Content -Path (Join-Path $ALGoFolder 'settings.json') -Value $projectSettings -Encoding UTF8 Set-Content -Path (Join-Path $Project1ALGoFolder 'settings.json') -Value $project1Settings -Encoding UTF8 - Test-ALGoRepository -baseFolder $tempDir + TestALGoRepository -baseFolder $tempDir } finally { Remove-Item -Path $tempDir -Recurse -Force