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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
github-closer
nohup.out
!.gitkeep
/vendor
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
setup:
go get -u github.com/google/go-github/github
go get -u github.com/jessevdk/go-flags
go get -u github.com/joho/godotenv
go get -u golang.org/x/oauth2
go get -u github.com/golang/dep/...
dep ensure

build:
go build
Expand Down
11 changes: 6 additions & 5 deletions issue_manager.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"errors"
"fmt"
"github.com/google/go-github/github"
Expand Down Expand Up @@ -38,7 +39,7 @@ func NewIssueManager(organization string, repository string, team string, token

func (im *IssueManager) FindIssues(spec string) ([]*github.Issue, error) {
queryString := im.buildQuery(spec)
searchResult, _, err := im.Client.Search.Issues(queryString, &github.SearchOptions{})
searchResult, _, err := im.Client.Search.Issues(context.Background(), queryString, &github.SearchOptions{})
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -74,7 +75,7 @@ func (im *IssueManager) Close(issue *github.Issue) (*github.Issue, error) {
issueRequest := &github.IssueRequest{}
issueRequest.State = String("closed")

i, _, err := im.Client.Issues.Edit(im.Organization, im.Repository, *issue.Number, issueRequest)
i, _, err := im.Client.Issues.Edit(context.Background(), im.Organization, im.Repository, *issue.Number, issueRequest)

return i, err
}
Expand All @@ -90,20 +91,20 @@ func (im *IssueManager) isUpdatedWithinDuration(issue *github.Issue) bool {

func (im *IssueManager) Comment(issue *github.Issue, comment string) bool {
ic := &github.IssueComment{Body: &comment}
_, _, err := im.Client.Issues.CreateComment(im.Organization, im.Repository, *issue.Number, ic)
_, _, err := im.Client.Issues.CreateComment(context.Background(), im.Organization, im.Repository, *issue.Number, ic)

return err != nil
}

func (im *IssueManager) findUsersByTeamName(name string) ([]*github.User, error) {
teams, _, err := im.Client.Repositories.ListTeams(im.Organization, im.Repository, nil)
teams, _, err := im.Client.Repositories.ListTeams(context.Background(), im.Organization, im.Repository, nil)
if err != nil {
return nil, err
}

for _, t := range teams {
if *t.Name == name {
users, _, err := im.Client.Organizations.ListTeamMembers(*t.ID, &github.OrganizationListTeamMembersOptions{})
users, _, err := im.Client.Organizations.ListTeamMembers(context.Background(), *t.ID, &github.OrganizationListTeamMembersOptions{})
return users, err
}
}
Expand Down
76 changes: 76 additions & 0 deletions lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"memo": "9a281f8bd9bc5bca5f1ad41c0db67aa22119add0d9ff15a6f550a9b38c4450e0",
"projects": [
{
"name": "github.com/golang/protobuf",
"branch": "master",
"revision": "c9c7427a2a70d2eb3bafa0ab2dc163e45f143317",
"packages": [
"proto"
]
},
{
"name": "github.com/google/go-github",
"branch": "master",
"revision": "69fd0adc8ab606780549a072f2e3b3f795d75832",
"packages": [
"github"
]
},
{
"name": "github.com/google/go-querystring",
"branch": "master",
"revision": "53e6ce116135b80d037921a7fdd5138cf32d7a8a",
"packages": [
"query"
]
},
{
"name": "github.com/jessevdk/go-flags",
"version": "v1.2.0",
"revision": "48cf8722c3375517aba351d1f7577c40663a4407",
"packages": [
"."
]
},
{
"name": "github.com/joho/godotenv",
"version": "v1.1",
"revision": "726cc8b906e3d31c70a9671c90a13716a8d3f50d",
"packages": [
"."
]
},
{
"name": "golang.org/x/net",
"branch": "master",
"revision": "a6577fac2d73be281a500b310739095313165611",
"packages": [
"context"
]
},
{
"name": "golang.org/x/oauth2",
"branch": "master",
"revision": "1611bb46e67abc64a71ecc5c3ae67f1cbbc2b921",
"packages": [
".",
"internal"
]
},
{
"name": "google.golang.org/appengine",
"version": "v1.0.0",
"revision": "150dc57a1b433e64154302bdc40b6bb8aefa313a",
"packages": [
"internal",
"internal/base",
"internal/datastore",
"internal/log",
"internal/remote_api",
"internal/urlfetch",
"urlfetch"
]
}
]
}
1 change: 1 addition & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}