Public/New-GitHubCacheKey.ps1
|
function New-GitHubCacheKey { [CmdletBinding()] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')] [OutputType([string])] param( [Parameter(Mandatory, Position = 0)] [ValidateNotNullOrEmpty()] [string[]] $Segment, [ValidateNotNullOrEmpty()] [string[]] $HashPath, [ValidateNotNullOrEmpty()] [string] $Separator = '-' ) $segments = [System.Collections.Generic.List[string]]::new() foreach ($currentSegment in $Segment) { $normalizedSegment = ConvertTo-GitHubCacheSegmentInternal -Value $currentSegment if ($null -ne $normalizedSegment) { $segments.Add($normalizedSegment) } } if ($PSBoundParameters.ContainsKey('HashPath')) { $segments.Add((Get-GitHubCacheHashInternal -File (Resolve-GitHubCacheHashInputInternal -Path $HashPath))) } return New-GitHubCacheKeyTextInternal -Segment $segments.ToArray() -Separator $Separator } |