Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions Get-PSGoodFirstIssue/Get-PSGoodFirstIssue.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
108 changes: 32 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,126 +2,82 @@

[![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] <Object>] [[-Repo] <Object>] [[-Labels] <Object>] [<CommonParameters>]
```
![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] <Object>]
[[-Repo] <Object>]
[[-Labels] <Object>]
[<CommonParameters>]
```

## EXAMPLES

### Example 1

```powershell
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"
```

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] <Object>]
[[-Language] <Object>]
[[-Label] <Object>]
[[-State] <Object>]
[<CommonParameters>]
```

### -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.
5 changes: 1 addition & 4 deletions docs/Get-PSGoodFirstIssue.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,27 @@ Gets a random issue from github.com/Powershell/Powershell labeled `Up-for-grabs`
## EXAMPLES

### Example 1

```powershell
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"
```

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 *
Expand Down Expand Up @@ -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)
Expand Down
20 changes: 12 additions & 8 deletions docs/Get-PSHacktoberFestIssue.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -18,7 +19,8 @@ Get-PSHacktoberFestIssue [[-OauthToken] <Object>] [[-Language] <Object>] [[-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

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Binary file added docs/media/Get-PsHacktoberFestIssue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/media/PATToken.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.