I am currently trying to run the PowerShell For Github module to generate lists or Github repos and their corresponding branches using a ForEach loop.
For each loop used:
Set-GitHubAuthentication
enter code here`#Access Token has generated from Github has been passed
#Get list of Repositories in Github Organization
$OrgName = Read-Host -Prompt 'Input your Organization name'
$repo = Get-GitHubRepository -OrganizationName $OrgName
$repo | Format-Table -Property name, full_name, visibility, updated_at
#parsing on the name property for the iteration to get branches
$reponame = $repo.name
#ForEach loop to iterate each repo name and their corresponding branches
$OwnerName = Read-Host -Prompt 'Input your Owner name'
foreach ($repo in $reponame) {
Get-GitHubRepositoryBranch -OwnerName "$OwnerName" -RepositoryName "$reponame"
}
Error gotten:
The remote server returned an error: (404) Not Found. 404 | Not Found Not Found | https://docs.github.com/rest/reference/repos#list-branches This typically happens when the current user isn't properly authenticated. You may need an Access Token with additional scopes checked. RequestId: 1919:0417:1D6C667:39908D7:618D59FD At C:\Program Files\WindowsPowerShell\Modules\PowerShellForGithub\0.16.0\GitHubCore.ps1:557 char:9 +throw $newLineOutput +~~~~~~~~~~~~~~~~~~~~ +CategoryInfo : OperationStopped: (The remote serv...9908D7:618D59FD:String) [], RuntimeException + FullyQualifiedErrorId : The remote server returned an error: (404) Not Found. 404 | Not Found Not Found | https://docs.github.com/rest/reference/repos#list-branches This typically happens when the current user isn't properly authenticated. You may need an Access Token with additional scopes checked. RequestId: 1919:0417:1D6C667:39908D7:618D59FD
Please any assistance will be appreciated as to how to resolve this block.