Skip to content

Commit

Permalink
Merge branch 'bump-github-version-v24' into wip-beta2
Browse files Browse the repository at this point in the history
  • Loading branch information
bltavares committed Apr 24, 2019
2 parents ceb926d + 6ed8dd1 commit be6193a
Show file tree
Hide file tree
Showing 38 changed files with 56 additions and 91 deletions.
2 changes: 1 addition & 1 deletion github/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"net/url"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/logging"
"golang.org/x/oauth2"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"log"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"strconv"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_branch_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"log"
"net/http"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
)
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_branch_protection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sort"
"testing"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_issue_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"net/http"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_issue_label_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"net/http"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_membership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
Expand Down
12 changes: 7 additions & 5 deletions github/resource_github_organization_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"
"strconv"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down Expand Up @@ -46,14 +46,15 @@ func resourceGithubOrganizationProjectCreate(d *schema.ResourceData, meta interf
client := meta.(*Organization).client
orgName := meta.(*Organization).name
name := d.Get("name").(string)
body := d.Get("body").(string)
ctx := context.Background()

log.Printf("[DEBUG] Creating organization project: %s (%s)", name, orgName)
project, _, err := client.Organizations.CreateProject(ctx,
orgName,
&github.ProjectOptions{
Name: name,
Body: d.Get("body").(string),
Name: &name,
Body: &body,
},
)
if err != nil {
Expand Down Expand Up @@ -108,9 +109,10 @@ func resourceGithubOrganizationProjectUpdate(d *schema.ResourceData, meta interf

orgName := meta.(*Organization).name
name := d.Get("name").(string)
body := d.Get("body").(string)
options := github.ProjectOptions{
Name: name,
Body: d.Get("body").(string),
Name: &name,
Body: &body,
}

projectID, err := strconv.ParseInt(d.Id(), 10, 64)
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_organization_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"testing"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
Expand Down
21 changes: 2 additions & 19 deletions github/resource_github_organization_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package github

import (
"context"
"fmt"
"log"
"net/http"
"strconv"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand All @@ -23,12 +22,6 @@ func resourceGithubOrganizationWebhook() *schema.Resource {
MigrateState: resourceGithubWebhookMigrateState,

Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateGithubOrganizationWebhookName,
},
"events": {
Type: schema.TypeSet,
Required: true,
Expand All @@ -53,13 +46,6 @@ func resourceGithubOrganizationWebhook() *schema.Resource {
}
}

func validateGithubOrganizationWebhookName(v interface{}, k string) (ws []string, errors []error) {
if v.(string) != "web" {
errors = append(errors, fmt.Errorf("Github: name can only be web"))
}
return
}

func resourceGithubOrganizationWebhookObject(d *schema.ResourceData) *github.Hook {
events := []string{}
eventSet := d.Get("events").(*schema.Set)
Expand All @@ -68,7 +54,6 @@ func resourceGithubOrganizationWebhookObject(d *schema.ResourceData) *github.Hoo
}

hook := &github.Hook{
Name: github.String(d.Get("name").(string)),
URL: github.String(d.Get("url").(string)),
Events: events,
Active: github.Bool(d.Get("active").(bool)),
Expand All @@ -89,8 +74,7 @@ func resourceGithubOrganizationWebhookCreate(d *schema.ResourceData, meta interf
webhookObj := resourceGithubOrganizationWebhookObject(d)
ctx := context.Background()

log.Printf("[DEBUG] Creating organization webhook: %s (%s)",
webhookObj.GetName(), orgName)
log.Printf("[DEBUG] Creating organization webhook: %d (%s)", webhookObj.GetID(), orgName)
hook, _, err := client.Organizations.CreateHook(ctx, orgName, webhookObj)

if err != nil {
Expand Down Expand Up @@ -132,7 +116,6 @@ func resourceGithubOrganizationWebhookRead(d *schema.ResourceData, meta interfac
}

d.Set("etag", resp.Header.Get("ETag"))
d.Set("name", hook.Name)
d.Set("url", hook.URL)
d.Set("active", hook.Active)
d.Set("events", hook.Events)
Expand Down
11 changes: 1 addition & 10 deletions github/resource_github_organization_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"testing"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
Expand All @@ -26,7 +26,6 @@ func TestAccGithubOrganizationWebhook_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckGithubOrganizationWebhookExists("github_organization_webhook.foo", &hook),
testAccCheckGithubOrganizationWebhookAttributes(&hook, &testAccGithubOrganizationWebhookExpectedAttributes{
Name: "web",
Events: []string{"pull_request"},
Configuration: map[string]interface{}{
"url": "https://google.de/webhook",
Expand All @@ -42,7 +41,6 @@ func TestAccGithubOrganizationWebhook_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckGithubOrganizationWebhookExists("github_organization_webhook.foo", &hook),
testAccCheckGithubOrganizationWebhookAttributes(&hook, &testAccGithubOrganizationWebhookExpectedAttributes{
Name: "web",
Events: []string{"issues"},
Configuration: map[string]interface{}{
"url": "https://google.de/webhooks",
Expand Down Expand Up @@ -70,7 +68,6 @@ func TestAccGithubOrganizationWebhook_secret(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckGithubOrganizationWebhookExists("github_organization_webhook.foo", &hook),
testAccCheckGithubOrganizationWebhookAttributes(&hook, &testAccGithubOrganizationWebhookExpectedAttributes{
Name: "web",
Events: []string{"pull_request"},
Configuration: map[string]interface{}{
"url": "https://www.terraform.io/webhook",
Expand Down Expand Up @@ -122,9 +119,6 @@ type testAccGithubOrganizationWebhookExpectedAttributes struct {
func testAccCheckGithubOrganizationWebhookAttributes(hook *github.Hook, want *testAccGithubOrganizationWebhookExpectedAttributes) resource.TestCheckFunc {
return func(s *terraform.State) error {

if *hook.Name != want.Name {
return fmt.Errorf("got hook %q; want %q", *hook.Name, want.Name)
}
if *hook.Active != want.Active {
return fmt.Errorf("got hook %t; want %t", *hook.Active, want.Active)
}
Expand Down Expand Up @@ -172,7 +166,6 @@ func testAccCheckGithubOrganizationWebhookDestroy(s *terraform.State) error {

const testAccGithubOrganizationWebhookConfig = `
resource "github_organization_webhook" "foo" {
name = "web"
configuration {
url = "https://google.de/webhook"
content_type = "json"
Expand All @@ -185,7 +178,6 @@ resource "github_organization_webhook" "foo" {

const testAccGithubOrganizationWebhookUpdateConfig = `
resource "github_organization_webhook" "foo" {
name = "web"
configuration {
url = "https://google.de/webhooks"
content_type = "form"
Expand All @@ -199,7 +191,6 @@ resource "github_organization_webhook" "foo" {

const testAccGithubOrganizationWebhookConfig_secret = `
resource "github_organization_webhook" "foo" {
name = "web"
configuration {
url = "https://www.terraform.io/webhook"
content_type = "json"
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_project_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"
"strings"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_project_column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"testing"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"net/http"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_repository_collaborator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"log"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_repository_deploy_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"
"strings"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down
14 changes: 8 additions & 6 deletions github/resource_github_repository_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"
"strings"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down Expand Up @@ -62,9 +62,10 @@ func resourceGithubRepositoryProjectCreate(d *schema.ResourceData, meta interfac
orgName := meta.(*Organization).name
repoName := d.Get("repository").(string)
name := d.Get("name").(string)
body := d.Get("body").(string)
options := github.ProjectOptions{
Name: name,
Body: d.Get("body").(string),
Name: &name,
Body: &body,
}
ctx := context.Background()

Expand Down Expand Up @@ -120,10 +121,11 @@ func resourceGithubRepositoryProjectRead(d *schema.ResourceData, meta interface{

func resourceGithubRepositoryProjectUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*Organization).client

name := d.Get("name").(string)
body := d.Get("body").(string)
options := github.ProjectOptions{
Name: d.Get("name").(string),
Body: d.Get("body").(string),
Name: &name,
Body: &body,
}

projectID, err := strconv.ParseInt(d.Id(), 10, 64)
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_repository_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"testing"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down
2 changes: 1 addition & 1 deletion github/resource_github_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"testing"

"github.com/google/go-github/github"
"github.com/google/go-github/v24/github"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down
Loading

0 comments on commit be6193a

Please sign in to comment.