Skip to content

Commit

Permalink
move
Browse files Browse the repository at this point in the history
  • Loading branch information
freddydk committed Nov 18, 2024
1 parent 28232d6 commit 1402a6f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
32 changes: 32 additions & 0 deletions Actions/Github-Helper.psm1
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
$script:escchars = @(' ','!','\"','#','$','%','\u0026','\u0027','(',')','*','+',',','-','.','/','0','1','2','3','4','5','6','7','8','9',':',';','\u003c','=','\u003e','?','@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\',']','^','_',[char]96,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','{','|','}','~')

function MaskValue {
Param(
[string] $key,
[string] $value
)

Write-Host "Masking value for $key"
$value.Split("`n") | ForEach-Object {
Write-Host "::add-mask::$_"
}

$val2 = ""
$value.ToCharArray() | ForEach-Object {
$chint = [int]$_
if ($chint -lt 32 -or $chint -gt 126 ) {
$val2 += $_
}
else {
$val2 += $script:escchars[$chint-32]
}
}

if ($val2 -ne $value) {
$val2.Split("`n") | ForEach-Object {
Write-Host "::add-mask::$_"
}
}
Write-Host "::add-mask::$([Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($value)))"
}

function GetExtendedErrorMessage {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingEmptyCatchBlock", "", Justification="We want to ignore errors")]
Param(
Expand Down
31 changes: 0 additions & 31 deletions Actions/ReadSecrets/ReadSecretsHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Param(
)

$script:gitHubSecrets = $_gitHubSecrets | ConvertFrom-Json
$script:escchars = @(' ','!','\"','#','$','%','\u0026','\u0027','(',')','*','+',',','-','.','/','0','1','2','3','4','5','6','7','8','9',':',';','\u003c','=','\u003e','?','@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','[','\\',']','^','_',[char]96,'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','{','|','}','~')

. (Join-Path -Path $PSScriptRoot -ChildPath "..\AL-Go-Helper.ps1" -Resolve)

Expand All @@ -26,36 +25,6 @@ function GetAzureCredentials {
return $null
}

function MaskValue {
Param(
[string] $key,
[string] $value
)

Write-Host "Masking value for $key"
$value.Split("`n") | ForEach-Object {
Write-Host "::add-mask::$_"
}

$val2 = ""
$value.ToCharArray() | ForEach-Object {
$chint = [int]$_
if ($chint -lt 32 -or $chint -gt 126 ) {
$val2 += $_
}
else {
$val2 += $script:escchars[$chint-32]
}
}

if ($val2 -ne $value) {
$val2.Split("`n") | ForEach-Object {
Write-Host "::add-mask::$_"
}
}
Write-Host "::add-mask::$([Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($value)))"
}

function GetGithubSecret {
param (
[string] $secretName,
Expand Down

0 comments on commit 1402a6f

Please sign in to comment.