Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invokegh #759

Merged
merged 6 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Actions/AL-Go-TestRepoHelper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,21 @@
Test-JsonStr -org -jsonStr (Get-Content -Path $jsonFile -Raw -Encoding UTF8) -settingsDescription $settingsFile -type $type
}

function Test-RunnerPrerequisites {
Fixed Show fixed Hide fixed
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 Test-ALGoRepository {
Param(
[string] $baseFolder = $ENV:GITHUB_WORKSPACE
Expand Down
17 changes: 5 additions & 12 deletions Actions/Github-Helper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -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
}
}

Expand Down
2 changes: 2 additions & 0 deletions Actions/WorkflowInitialize/WorkflowInitialize.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ try {

DownloadAndImportBcContainerHelper

Test-RunnerPrerequisites

import-module (Join-Path -path $PSScriptRoot -ChildPath "..\TelemetryHelper.psm1" -Resolve)
$telemetryScope = CreateScope -eventId $eventId
if ($telemetryScope) {
Expand Down
Loading