@@ -31,8 +31,8 @@ Function Expand-ToolCacheCompressedFile {
3131 [Parameter (Mandatory = $True , Position = 0 , ValueFromPipeline = $True , ValueFromPipelineByPropertyName = $True )][Alias (' Source' )][String ]$File ,
3232 [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Target' )][String ]$Destination ,
3333 [Parameter (ValueFromPipelineByPropertyName = $True )][ValidateSet (' 7z' , ' Auto' , ' Automatic' , ' Automatically' , ' Tar' , ' Xar' , ' Zip' )][String ]$Method = ' Automatically' ,
34- [String ]$7zrPath = ' ' ,
35- [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Flags' )][String ]$Flag = ' '
34+ [String ]$7zrPath ,
35+ [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Flags' )][String ]$Flag
3636 )
3737 Begin {
3838 [Boolean ]$NoOperation = $False # When the requirements are not fulfill, only stop this function but not others.
@@ -117,7 +117,7 @@ Function Find-ToolCache {
117117 Param (
118118 [Parameter (Mandatory = $True , Position = 0 , ValueFromPipeline = $True , ValueFromPipelineByPropertyName = $True )][Alias (' ToolName' )][String ]$Name ,
119119 [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Ver' )][String ]$Version = ' *' ,
120- [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Arch' )][String ]$Architecture = ' '
120+ [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Arch' )][String ]$Architecture
121121 )
122122 Begin {
123123 [Boolean ]$NoOperation = $False # When the requirements are not fulfill, only stop this function but not others.
@@ -170,10 +170,10 @@ Function Invoke-ToolCacheToolDownloader {
170170 [CmdletBinding (HelpUri = ' https://github.com/hugoalh-studio/ghactions-toolkit-powershell/wiki/api_function_invoke-githubactionstoolcachetooldownloader#Invoke-GitHubActionsToolCacheToolDownloader' )]
171171 [OutputType ([String ])]
172172 Param (
173- [Parameter (Mandatory = $True , Position = 0 , ValueFromPipeline = $True , ValueFromPipelineByPropertyName = $True )][ValidateScript ({ Return (($Null -ine $_.AbsoluteUri ) -and ($_.Scheme -imatch ' ^https?$' )) }, ErrorMessage = ' `{0}` is not a valid URI!' )][Alias (' Url' )][Uri ]$Uri ,
174- [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Target' )][String ]$Destination = ' ' ,
175- [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Auth' )][String ]$Authorization = ' ' ,
176- [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Headers' )][Hashtable ]$Header = @ {}
173+ [Parameter (Mandatory = $True , Position = 0 , ValueFromPipeline = $True , ValueFromPipelineByPropertyName = $True )][ValidateScript ({ Return (($Null -ine $_.AbsoluteUri ) -and ($_.Scheme -imatch ' ^https?$' )) }, ErrorMessage = ' `{0}` is not a valid URI!' )][Alias (' Source ' , ' Url' )][Uri ]$Uri ,
174+ [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Target' )][String ]$Destination ,
175+ [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Auth' )][String ]$Authorization ,
176+ [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Headers' )][Hashtable ]$Header
177177 )
178178 Begin {
179179 [Boolean ]$NoOperation = $False # When the requirements are not fulfill, only stop this function but not others.
@@ -187,7 +187,7 @@ Function Invoke-ToolCacheToolDownloader {
187187 Return
188188 }
189189 [Hashtable ]$InputObject = @ {
190- Uri = $Uri
190+ Uri = $Uri.ToString ()
191191 }
192192 If ($Destination.Length -igt 0 ) {
193193 $InputObject.Destination = $Destination
@@ -196,7 +196,7 @@ Function Invoke-ToolCacheToolDownloader {
196196 $InputObject.Authorization = $Authorization
197197 }
198198 If ($Header.Count -igt 0 ) {
199- $InputObject.Header = ( [PSCustomObject ]$Header | ConvertTo-Json - Depth 100 - Compress)
199+ $InputObject.Header = [PSCustomObject ]$Header
200200 }
201201 $ResultRaw = Invoke-GitHubActionsNodeJsWrapper - Path ' tool-cache\download-tool.js' - InputObject ([PSCustomObject ]$InputObject | ConvertTo-Json - Depth 100 - Compress)
202202 If ($Null -ieq $ResultRaw ) {
@@ -229,7 +229,7 @@ Function Register-ToolCacheDirectory {
229229 [Parameter (Mandatory = $True , Position = 0 , ValueFromPipelineByPropertyName = $True )][Alias (' SourceDirectory' )][String ]$Source ,
230230 [Parameter (Mandatory = $True , Position = 1 , ValueFromPipelineByPropertyName = $True )][Alias (' ToolName' )][String ]$Name ,
231231 [Parameter (Mandatory = $True , Position = 2 , ValueFromPipelineByPropertyName = $True )][Alias (' Ver' )][String ]$Version ,
232- [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Arch' )][String ]$Architecture = ' '
232+ [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Arch' )][String ]$Architecture
233233 )
234234 Begin {
235235 [Boolean ]$NoOperation = $False # When the requirements are not fulfill, only stop this function but not others.
@@ -250,7 +250,7 @@ Function Register-ToolCacheDirectory {
250250 If ($Architecture.Length -igt 0 ) {
251251 $InputObject.Architecture = $Architecture
252252 }
253- $ResultRaw = Invoke-GitHubActionsNodeJsWrapper - Path " tool-cache\cache-directory.js" - InputObject ([PSCustomObject ]$InputObject | ConvertTo-Json - Depth 100 - Compress)
253+ $ResultRaw = Invoke-GitHubActionsNodeJsWrapper - Path ' tool-cache\cache-directory.js' - InputObject ([PSCustomObject ]$InputObject | ConvertTo-Json - Depth 100 - Compress)
254254 If ($Null -ieq $ResultRaw ) {
255255 Return
256256 }
@@ -284,7 +284,7 @@ Function Register-ToolCacheFile {
284284 [Parameter (Mandatory = $True , Position = 1 , ValueFromPipelineByPropertyName = $True )][Alias (' TargetFile' )][String ]$Target ,
285285 [Parameter (Mandatory = $True , Position = 2 , ValueFromPipelineByPropertyName = $True )][Alias (' ToolName' )][String ]$Name ,
286286 [Parameter (Mandatory = $True , Position = 3 , ValueFromPipelineByPropertyName = $True )][Alias (' Ver' )][String ]$Version ,
287- [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Arch' )][String ]$Architecture = ' '
287+ [Parameter (ValueFromPipelineByPropertyName = $True )][Alias (' Arch' )][String ]$Architecture
288288 )
289289 Begin {
290290 [Boolean ]$NoOperation = $False # When the requirements are not fulfill, only stop this function but not others.
@@ -306,7 +306,7 @@ Function Register-ToolCacheFile {
306306 If ($Architecture.Length -igt 0 ) {
307307 $InputObject.Architecture = $Architecture
308308 }
309- $ResultRaw = Invoke-GitHubActionsNodeJsWrapper - Path " tool-cache\cache-file.js" - InputObject ([PSCustomObject ]$InputObject | ConvertTo-Json - Depth 100 - Compress)
309+ $ResultRaw = Invoke-GitHubActionsNodeJsWrapper - Path ' tool-cache\cache-file.js' - InputObject ([PSCustomObject ]$InputObject | ConvertTo-Json - Depth 100 - Compress)
310310 If ($Null -ieq $ResultRaw ) {
311311 Return
312312 }
0 commit comments