diff --git a/Get-PSGoodFirstIssue/Get-PSGoodFirstIssue.psm1 b/Get-PSGoodFirstIssue/Get-PSGoodFirstIssue.psm1 index f14e98a..acd50d1 100644 --- a/Get-PSGoodFirstIssue/Get-PSGoodFirstIssue.psm1 +++ b/Get-PSGoodFirstIssue/Get-PSGoodFirstIssue.psm1 @@ -47,24 +47,22 @@ function Get-PSHacktoberFestIssue { $OauthToken, $Language = 'powershell', $Label = 'hacktoberfest', + [Parameter()] + [ValidateSet('open', 'closed')] $State = 'open' ) process { - $irmbody = @{ - labels = $Label - state = $state - } if ($OauthToken) { $irmheader = @{ Authorization = "token $OauthToken" } } - $uri = "https://api.github.com/search/issues?q=language:{0}+label:{1}+state:{2}" -f $Language, $Label, $State + $uri = "https://api.github.com/search/issues?q=language:{0}+label:{1}+state:{2}&per_page=100" -f $Language, $Label, $State - $result = Invoke-RestMethod $uri -Body $irmbody -Headers $irmheader -FollowRelLink + $result = Invoke-RestMethod $uri -Headers $irmheader -FollowRelLink $issue = $result.items | Get-Random $issue.pstypenames.insert(0,"PSGFI.GithubIssue") diff --git a/README.md b/README.md index dcdf738..002514b 100644 --- a/README.md +++ b/README.md @@ -2,32 +2,38 @@ [![Build status](https://ci.appveyor.com/api/projects/status/3n4785ixqkyvubae/branch/master?svg=true)](https://ci.appveyor.com/project/tomlarse/get-psgoodfirstissue/branch/master) + ![Get-PsGoodFirstIssue](docs/media/result.png) -## SYNOPSIS +![Get-PsHacktoberFestIssue](docs/media/Get-PsHacktoberFestIssue.png) -Gets a random issue from github.com/Powershell/Powershell labeled `Up-for-grabs` ## INSTALLATION - ```powershell Install-Module Get-PSGoodFirstIssue -Scope CurrentUser ``` -## SYNTAX +## Rate Limiting +The Github API has rate limiting for fair usage. You can add a PAT token to your account under Developer Settings and provide it with the following permissions to increase your rate limit. -```powershell -Get-PSGoodFirstIssue [[-OauthToken] ] [[-Repo] ] [[-Labels] ] [] -``` +![PATToken](docs/media/PATToken.png) -## DESCRIPTION +## Get-PSGoodFirstIssue Gets a random issue from github.com/Powershell/Powershell labeled `Up-for-grabs` +### Syntax +```yaml +Get-PSGoodFirstIssue + [[-OauthToken] ] + [[-Repo] ] + [[-Labels] ] + [] +``` + ## EXAMPLES ### Example 1 - ```powershell PS C:\> Get-PSGoodFirstIssue ``` @@ -35,7 +41,6 @@ PS C:\> Get-PSGoodFirstIssue Gets a random issue labeled `up-for-grabs` from the powershell/powershell repo. ### Example 2 - ```powershell PS C:\> Get-PSGoodFirstIssue -Repo "Powershell/vscode-powershell" ``` @@ -43,85 +48,36 @@ PS C:\> Get-PSGoodFirstIssue -Repo "Powershell/vscode-powershell" Gets a random issue labeled `up-for-grabs` from the powershell/vscode-powershell repo. ### Example 3 - ```powershell PS C:\> Get-PSGoodFirstIssue -Repo "Powershell/vscode-powershell" -Labels "Issue-bug" ``` Gets a random issue labeled `Issue-bug` from the powershell/vscode-powershell repo. -### Example 4 - -```powershell -PS C:\> $iss = Get-PSGoodFirstIssue -PS C:\> $iss | Select-Object -Property * -``` - -Will list all available properties, not just the pretty synopsis. - -## PARAMETERS - -### -Labels +## Get-PSHacktoberFestIssue -Label to get a random issue from. Per the github api spec it should be possible with a comma separated list, but it does not currently work. +Gets a random issue from any repo with the language PowerShell and the label `Hacktoberfest` +### Syntax ```yaml -Type: Object -Parameter Sets: (All) -Aliases: - -Required: False -Position: 2 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False +Get-PSHacktoberFestIssue + [[-OauthToken] ] + [[-Language] ] + [[-Label] ] + [[-State] ] + [] ``` -### -OauthToken - -After 60 calls to the API in an hour, github will block you. Use an oAuth token from [https://github.com/settings/tokens](https://github.com/settings/tokens) to authenticate in that case +## EXAMPLES -```yaml -Type: Object -Parameter Sets: (All) -Aliases: - -Required: False -Position: 0 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False +### Example 1 +```powershell +PS C:\> Get-PSHacktoberFestIssue ``` -### -Repo - -The repo to search in. Use `owner/repo` format. - -```yaml -Type: Object -Parameter Sets: (All) -Aliases: - -Required: False -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False +### Example 2 +```powershell +PS C:\> Get-PSHacktoberFestIssue -OauthToken $token ``` -### CommonParameters - -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. -For more information, see about_CommonParameters [http://go.microsoft.com/fwlink/?LinkID=113216](http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### None - -## OUTPUTS - -### System.Management.Automation.PSCustomObject - -## NOTES - -## RELATED LINKS +Gets a random issue from any repo with the language PowerShell and the label `Hacktoberfest` using oAuth authentication. diff --git a/docs/Get-PSGoodFirstIssue.md b/docs/Get-PSGoodFirstIssue.md index ec574a0..e52968b 100644 --- a/docs/Get-PSGoodFirstIssue.md +++ b/docs/Get-PSGoodFirstIssue.md @@ -22,7 +22,6 @@ Gets a random issue from github.com/Powershell/Powershell labeled `Up-for-grabs` ## EXAMPLES ### Example 1 - ```powershell PS C:\> Get-PSGoodFirstIssue ``` @@ -30,7 +29,6 @@ PS C:\> Get-PSGoodFirstIssue Gets a random issue labeled `up-for-grabs` from the powershell/powershell repo. ### Example 2 - ```powershell PS C:\> Get-PSGoodFirstIssue -Repo "Powershell/vscode-powershell" ``` @@ -38,7 +36,6 @@ PS C:\> Get-PSGoodFirstIssue -Repo "Powershell/vscode-powershell" Gets a random issue labeled `up-for-grabs` from the powershell/vscode-powershell repo. ### Example 3 - ```powershell PS C:\> Get-PSGoodFirstIssue -Repo "Powershell/vscode-powershell" -Labels "Issue-bug" ``` @@ -46,7 +43,6 @@ PS C:\> Get-PSGoodFirstIssue -Repo "Powershell/vscode-powershell" -Labels "Issue Gets a random issue labeled `Issue-bug` from the powershell/vscode-powershell repo. ### Example 4 - ```powershell PS C:\> $iss = Get-PSGoodFirstIssue PS C:\> $iss | Select-Object -Property * @@ -74,6 +70,7 @@ Accept wildcard characters: False ### -OauthToken After 60 calls to the API in an hour, github will block you. Use an oAuth token from [https://github.com/settings/tokens](https://github.com/settings/tokens) to authenticate in that case + ```yaml Type: Object Parameter Sets: (All) diff --git a/docs/Get-PSHacktoberFestIssue.md b/docs/Get-PSHacktoberFestIssue.md index c7b0019..a36467b 100644 --- a/docs/Get-PSHacktoberFestIssue.md +++ b/docs/Get-PSHacktoberFestIssue.md @@ -8,7 +8,8 @@ schema: 2.0.0 # Get-PSHacktoberFestIssue ## SYNOPSIS -Gets a random issue from with language `powershell` labeled `Hacktoberfest`. +Gets a random issue from any repo with the language PowerShell and the label `Hacktoberfest` + ## SYNTAX @@ -18,7 +19,8 @@ Get-PSHacktoberFestIssue [[-OauthToken] ] [[-Language] ] [[-Labe ``` ## DESCRIPTION -Gets a random issue from with language `powershell` labeled `Hacktoberfest`. +Gets a random issue from any repo with the language PowerShell and the label `Hacktoberfest` + ## EXAMPLES @@ -27,19 +29,20 @@ Gets a random issue from with language `powershell` labeled `Hacktoberfest`. PS C:\> Get-PSHacktoberFestIssue ``` -Gets a random issue with the label `hacktoberfest` and language powershell. +Gets a random issue from any repo with the language PowerShell and the label `Hacktoberfest` ### Example 2 - ```powershell PS C:\> Get-PSHacktoberFestIssue -OauthToken $token ``` -Uses a given token to authenticate user. + +Gets a random issue from any repo with the language PowerShell and the label `Hacktoberfest` using oAuth authentication. ## PARAMETERS ### -Label -Label to get a random issue from. Per the github api spec it should be possible with a comma separated list, but it does not currently work. +Label to get a random issue from. Default value set to `hacktoberfest` but can be overridden. Rate Limiting may take effect on more popular languages. + ```yaml Type: Object @@ -54,7 +57,8 @@ Accept wildcard characters: False ``` ### -Language -Limit searches to a given language +Programming language to search for. Default value is `PowerShell` but can be overridden. Rate Limiting may take effect on more popular languages. + ```yaml Type: Object @@ -84,7 +88,7 @@ Accept wildcard characters: False ``` ### -State -Can be used to return issues that are closed. Defaults to open. +The state of the issues. Valid values are Open or Closed ```yaml Type: Object diff --git a/docs/media/Get-PsHacktoberFestIssue.png b/docs/media/Get-PsHacktoberFestIssue.png new file mode 100644 index 0000000..02fbc43 Binary files /dev/null and b/docs/media/Get-PsHacktoberFestIssue.png differ diff --git a/docs/media/PATToken.png b/docs/media/PATToken.png new file mode 100644 index 0000000..5e4dd56 Binary files /dev/null and b/docs/media/PATToken.png differ