Skip to content

Commit

Permalink
Fix + Add Get-repo lang
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Oct 30, 2023
1 parent fad1949 commit 679e926
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
filter Get-GitHubRepositoryLanguage {
<#
.SYNOPSIS
List repository languages
.DESCRIPTION
Lists languages for the specified repository. The value shown for each language is the number of
bytes of code written in that language.
.EXAMPLE
Get-GitHubRepositoryLanguage -Owner 'octocat' -Repo 'hello-world'
Gets the languages for the 'hello-world' repository owned by 'octocat'.
.NOTES
https://docs.github.com/rest/repos/repos#list-repository-languages
#>
[CmdletBinding()]
[Alias('Get-GitHubRepositoryLanguages')]
param (
# The account owner of the repository. The name is not case sensitive.
[Parameter()]
[Alias('org')]
[string] $Owner = (Get-GitHubConfig -Name Owner),

# The name of the repository without the .git extension. The name is not case sensitive.
[Parameter()]
[string] $Repo = (Get-GitHubConfig -Name Repo)
)

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/languages"
Method = 'GET'
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@
[string] $Repo = (Get-GitHubConfig -Name Repo)
)

$body = $PSBoundParameters | ConvertFrom-HashTable | ConvertTo-HashTable -NameCasingStyle snake_case
Remove-HashtableEntry -Hashtable $body -RemoveNames 'Owner', 'Repo' -RemoveTypes 'SwitchParameter'

$inputObject = @{
APIEndpoint = "/repos/$Owner/$Repo/automated-security-fixes"
Method = 'GET'
Body = $body
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Expand Down

0 comments on commit 679e926

Please sign in to comment.