Skip to content

Commit 65415b1

Browse files
committed
20240201A
1 parent 7f10fb1 commit 65415b1

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

hugoalh.GitHubActionsToolkit/hugoalh.GitHubActionsToolkit.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
ReleaseNotes = '(Please visit https://github.com/hugoalh-studio/ghactions-toolkit-powershell/releases.)'
220220

221221
# Prerelease string of this module
222-
Prerelease = 'beta2'
222+
Prerelease = 'beta3'
223223

224224
# Flag to indicate whether the module requires explicit user acceptance for install/update/save
225225
RequireLicenseAcceptance = $False

hugoalh.GitHubActionsToolkit/lib/command-file.psm1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Value.
1616
Function Add-FileCommand {
1717
[OutputType([Void])]
1818
Param (
19-
[Parameter(Mandatory = $True, Position = 0)][ValidatePattern('^.+$', ErrorMessage = 'Value is not a single line string!')][Alias('CommandPath')][String]$FileCommandPath,
20-
[Parameter(Mandatory = $True, Position = 1)][ValidatePattern('^.+$', ErrorMessage = 'Value is not a single line string!')][String]$Name,
19+
[Parameter(Mandatory = $True, Position = 0)][Alias('CommandPath')][String]$FileCommandPath,
20+
[Parameter(Mandatory = $True, Position = 1)][String]$Name,
2121
[Parameter(Mandatory = $True, Position = 2)][AllowEmptyString()][AllowNull()][String]$Value
2222
)
2323
If ($Value -imatch '^.*$') {
@@ -26,9 +26,11 @@ Function Add-FileCommand {
2626
Else {
2727
Do {
2828
[String]$Token = (New-Guid).Guid.ToLower() -ireplace '-', ''
29-
[String]$TokenRegExEscape = [RegEx]::Escape($Token)
3029
}
31-
While ($Name -imatch $TokenRegExEscape -or $Value -imatch $TokenRegExEscape)
30+
While (
31+
$Name -imatch $Token -or
32+
$Value -imatch $Token
33+
)
3234
[String]$Content = "$Name<<$Token`n$($Value -ireplace '\r?\n', "`n")`n$Token"
3335
}
3436
Add-Content -LiteralPath $FileCommandPath -Value $Content -Confirm:$False -Encoding 'UTF8NoBOM'
@@ -103,7 +105,8 @@ Function Get-FileCommand {
103105
}
104106
$Result += [PSCustomObject]@{
105107
Name = $Name
106-
Value = $Value
108+
Value = $Value |
109+
Join-String -Separator "`n"
107110
Raw = @($CurrentLine) + $Value + @($Delimiter)
108111
}
109112
$Index = $IndexOffset
@@ -201,7 +204,7 @@ Function Write-FileCommand {
201204
[OutputType([Void])]
202205
Param (
203206
[Parameter(Mandatory = $True, Position = 0)][Alias('Command')][String]$FileCommand,
204-
[Parameter(Mandatory = $True, Position = 1, ValueFromPipelineByPropertyName = $True)][ValidatePattern('^.+$', ErrorMessage = 'Value is not a single line string!')][String]$Name,
207+
[Parameter(Mandatory = $True, Position = 1, ValueFromPipelineByPropertyName = $True)][ValidatePattern('^(?:[\da-z][\da-z_-]*)?[\da-z]$', ErrorMessage = 'Value is not a valid GitHub Actions file command property name!')][String]$Name,
205208
[Parameter(Mandatory = $True, Position = 2, ValueFromPipelineByPropertyName = $True)][AllowEmptyString()][AllowNull()][String]$Value,
206209
[Switch]$Optimize
207210
)

0 commit comments

Comments
 (0)