How to: Secrets Mapping on GitHub

$UriOrganization = "https://api.github.com/orgs/$($organization)"$OrganizationResult = Invoke-RestMethod -Headers $headers -Uri $UriOrganizationWrite-Host $OrganizationResult.id
$uriOrganizationSecrets = "$($UriOrganization)/actions/secrets"$OrganizationSecretsResult = Invoke-RestMethod -Headers $headers -Uri $uriOrganizationSecretsforeach ($orgSecret in $OrganizationSecretsResult.secrets)
{
Write-Host $orgSecret.name
}
$uriRepositories = "$($UriOrganization)/repos"$RepositoriesResult = Invoke-RestMethod -Headers $headers -Uri $uriRepositoriesforeach ($repo in $RepositoriesResult)
{
Write-Host $repo.name
}
$uriRepositoriesSecrets = "$($UriRepositoriesOwner)/$($repo.name)/actions/secrets"    $RepositoriesSecretsResult = Invoke-RestMethod -Headers $headers -Uri $uriRepositoriesSecrets    foreach ($repoSecret in $RepositoriesSecretsResult.secrets)    
{
Write-Host $repoSecret.name
}
$uriRepositoriesEnvironments = "$($UriRepositoriesOwner)/$($repo.name)/environments"    $RepositoriesEnvironmentsResult = Invoke-RestMethod -Headers $headers -Uri $uriRepositoriesEnvironments    foreach ($repoenvironment in $RepositoriesEnvironmentsResult.environments)    
{
Write-Host $repoenvironment.name
}
$uriRepositoriesEnvironmentsSecrets = "https://api.github.com/repositories/$($repo.id)/environments/$($repoenvironment.name)/secrets"        $RepositoriesEnvironmentsSecrets = Invoke-RestMethod -Headers $headers -Uri $uriRepositoriesEnvironmentsSecrets        foreach ($repoenvironmentsecret in $RepositoriesEnvironmentsSecrets.secrets)
{
Write-Host $repoenvironmentsecret.name
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store