Skip to content

Commit

Permalink
rebase and fix build errors
Browse files Browse the repository at this point in the history
- update to go-github v32
- use `Owner` instead of `Organization`
  • Loading branch information
Jeremy Udit committed Nov 22, 2020
1 parent c4d7a7d commit 41446df
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion github/data_source_github_repository_milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func dataSourceGithubRepositoryMilestone() *schema.Resource {
}

func dataSourceGithubRepositoryMilestoneRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*Organization).v3client
conn := meta.(*Owner).v3client
ctx := context.Background()

owner := d.Get("owner").(string)
Expand Down
15 changes: 8 additions & 7 deletions github/resource_github_repository_milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package github
import (
"context"
"fmt"
"github.com/google/go-github/v31/github"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"log"
"net/http"
"strconv"
"strings"
"time"

"github.com/google/go-github/v32/github"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)

func resourceGithubRepositoryMilestone() *schema.Resource {
Expand Down Expand Up @@ -81,7 +82,7 @@ const (
)

func resourceGithubRepositoryMilestoneCreate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*Organization).v3client
conn := meta.(*Owner).v3client
ctx := context.Background()
owner := d.Get("owner").(string)
repoName := d.Get("repository").(string)
Expand Down Expand Up @@ -117,7 +118,7 @@ func resourceGithubRepositoryMilestoneCreate(d *schema.ResourceData, meta interf
}

func resourceGithubRepositoryMilestoneRead(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*Organization).v3client
conn := meta.(*Owner).v3client
ctx := context.WithValue(context.Background(), ctxId, d.Id())

owner := d.Get("owner").(string)
Expand Down Expand Up @@ -156,7 +157,7 @@ func resourceGithubRepositoryMilestoneRead(d *schema.ResourceData, meta interfac
}

func resourceGithubRepositoryMilestoneUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*Organization).v3client
conn := meta.(*Owner).v3client
ctx := context.WithValue(context.Background(), ctxId, d.Id())
owner := d.Get("owner").(string)
repoName := d.Get("repository").(string)
Expand Down Expand Up @@ -201,7 +202,7 @@ func resourceGithubRepositoryMilestoneUpdate(d *schema.ResourceData, meta interf
}

func resourceGithubRepositoryMilestoneDelete(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*Organization).v3client
conn := meta.(*Owner).v3client
ctx := context.WithValue(context.Background(), ctxId, d.Id())
owner := d.Get("owner").(string)
repoName := d.Get("repository").(string)
Expand Down
8 changes: 4 additions & 4 deletions github/resource_github_repository_milestone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/google/go-github/v31/github"
"github.com/google/go-github/v32/github"
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
Expand Down Expand Up @@ -185,7 +185,7 @@ func testAccCheckGithubRepositoryMilestoneExists(rn string, milestone *github.Mi
return fmt.Errorf("no Milestone ID is set")
}

conn := testAccProvider.Meta().(*Organization).v3client
conn := testAccProvider.Meta().(*Owner).v3client
number, err := parseMilestoneNumber(rs.Primary.ID)
if err != nil {
return err
Expand All @@ -209,7 +209,7 @@ func testAccCheckGithubRepositoryMilestoneDisappears(rn string) resource.TestChe
if !ok {
return fmt.Errorf("Not found: %s", rn)
}
conn := testAccProvider.Meta().(*Organization).v3client
conn := testAccProvider.Meta().(*Owner).v3client
number, err := parseMilestoneNumber(rs.Primary.ID)
if err != nil {
return err
Expand All @@ -224,7 +224,7 @@ func testAccCheckGithubRepositoryMilestoneDisappears(rn string) resource.TestChe
}

func testAccCheckGithubRepositoryMilestoneDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*Organization).v3client
conn := testAccProvider.Meta().(*Owner).v3client

for _, rs := range s.RootModule().Resources {
if rs.Type != "github_repository_milestone" {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.13
require (
github.com/client9/misspell v0.3.4
github.com/golangci/golangci-lint v1.25.1
github.com/google/go-github/v31 v31.0.0
github.com/google/go-github/v32 v32.1.0
github.com/hashicorp/terraform v0.12.24
github.com/hashicorp/terraform-plugin-sdk v1.7.0
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github/v31 v31.0.0 h1:JJUxlP9lFK+ziXKimTCprajMApV1ecWD4NB6CCb0plo=
github.com/google/go-github/v31 v31.0.0/go.mod h1:NQPZol8/1sMoWYGN2yaALIBytu17gAWfhbweiEed3pM=
github.com/google/go-github/v32 v31.0.0 h1:JJUxlP9lFK+ziXKimTCprajMApV1ecWD4NB6CCb0plo=
github.com/google/go-github/v32 v31.0.0/go.mod h1:NQPZol8/1sMoWYGN2yaALIBytu17gAWfhbweiEed3pM=
github.com/google/go-github/v32 v32.1.0 h1:GWkQOdXqviCPx7Q7Fj+KyPoGm4SwHRh8rheoPhd27II=
Expand Down

0 comments on commit 41446df

Please sign in to comment.