Skip to content

Commit

Permalink
Fix size problem in invoke-gh (#3205)
Browse files Browse the repository at this point in the history
And do not hide real reason for the error

---------

Co-authored-by: freddydk <[email protected]>
  • Loading branch information
freddydk and freddydk authored Oct 7, 2023
1 parent b88f0ee commit c95dedf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
24 changes: 12 additions & 12 deletions Common/Invoke-gh.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ function invoke-gh {
[parameter(mandatory = $false, position = 1, ValueFromRemainingArguments = $true)] $remaining
)

$arguments = "$command "
$remaining | ForEach-Object {
if ("$_".IndexOf(" ") -ge 0 -or "$_".IndexOf('"') -ge 0) {
$arguments += """$($_.Replace('"','\"'))"" "
Process {
$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 "
}
}
else {
$arguments += "$_ "
}
}
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/"
}
}

Export-ModuleMember -Function Invoke-gh
21 changes: 9 additions & 12 deletions Common/Invoke-git.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ function invoke-git {
[parameter(mandatory = $false, position = 1, ValueFromRemainingArguments = $true)] $remaining
)

$arguments = "$command "
$remaining | ForEach-Object {
if ("$_".IndexOf(" ") -ge 0 -or "$_".IndexOf('"') -ge 0) {
$arguments += """$($_.Replace('"','\"'))"" "
Process {
$arguments = "$command "
foreach($parameter in $remaining) {
if ("$parameter".IndexOf(" ") -ge 0 -or "$parameter".IndexOf('"') -ge 0) {
$arguments += """$($parameter.Replace('"','\"'))"" "
}
else {
$arguments += "$parameter "
}
}
else {
$arguments += "$_ "
}
}
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"
}
}
Export-ModuleMember -Function Invoke-git
2 changes: 2 additions & 0 deletions ReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ The insider SAS token is still supported until April 2024 where the last insider
Remove the need for Insider SAS token in Create Container wizard and Create AL-Go repo wizard
Add parameter EnableExternalRulesets to Run-AlPipeline (which will be added to the compiler when compiling)
Issue https://github.com/microsoft/AL-Go/issues/709 Include unknown app dependencies from previous apps (which doesn't already exist in unknown app dependencies)
Do not hide real exception in invoke-git and invoke-gh
Truncate body part to 15000 characters in invoke-gh

5.0.7
Run-AlValidation also needs to install NAVSIP dependencies (issue #3190)
Expand Down

0 comments on commit c95dedf

Please sign in to comment.