Skip to content

Commit

Permalink
check for line breaks for all settings (microsoft#698)
Browse files Browse the repository at this point in the history
Co-authored-by: freddydk <[email protected]>
  • Loading branch information
freddydk and freddydk authored Sep 8, 2023
1 parent a32620a commit 13989cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Actions/ReadSettings/ReadSettings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ $outSettings = @{}
$settings.Keys | ForEach-Object {
$setting = $_
$settingValue = $settings."$setting"
if ($settingValue -is [String] -and ($settingValue.contains("`n") -or $settingValue.contains("`r"))) {
throw "Setting $setting contains line breaks, which is not supported"
}
$outSettings += @{ "$setting" = $settingValue }
if ($getSettings -contains $setting) {
if ($settingValue -is [System.Collections.Specialized.OrderedDictionary] -or $settingValue -is [hashtable]) {
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "$setting=$(ConvertTo-Json $settingValue -Depth 99 -Compress)"
}
elseif ($settingValue -is [String] -and ($settingValue.contains("`n") -or $settingValue.contains("`r"))) {
throw "Setting $setting contains line breaks, which is not supported"
}
else {
Add-Content -Encoding UTF8 -Path $env:GITHUB_ENV -Value "$setting=$settingValue"
}
Expand Down

0 comments on commit 13989cd

Please sign in to comment.