functions/internal/Get-GithubHeaders.ps1

function Get-GithubHeaders{
    process{ 
        $PAT = Get-CustomerConfig -XPath "//credential[@name='GithubPAT']//@value"

        # Ensure token is not empty
        if ([string]::IsNullOrEmpty($PAT)) { 
            throw 'GithubPAT inside \_Install\_Tools\customer.config is null or empty!'
        }

        $encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$($PAT):x-oauth-basic"))
        $headers = @{ 
            Authorization = "Basic $encodedCreds" 
        }

        $headers
    }
}