Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump go-github to v62 + fixes #2304

Merged
merged 14 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 12 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
2 changes: 1 addition & 1 deletion github/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"time"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/shurcooL/githubv4"
"golang.org/x/oauth2"
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_actions_environment_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"net/url"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
9 changes: 2 additions & 7 deletions github/data_source_github_actions_environment_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"net/url"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down Expand Up @@ -83,18 +83,13 @@ func dataSourceGithubActionsEnvironmentVariablesRead(d *schema.ResourceData, met
return fmt.Errorf("one of %q or %q has to be provided", "full_name", "name")
}

repo, _, err := client.Repositories.Get(context.TODO(), owner, repoName)
if err != nil {
return err
}

options := github.ListOptions{
PerPage: 100,
}

var all_variables []map[string]string
for {
variables, resp, err := client.Actions.ListEnvVariables(context.TODO(), int(repo.GetID()), escapedEnvName, &options)
variables, resp, err := client.Actions.ListEnvVariables(context.TODO(), owner, repoName, escapedEnvName, &options)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_actions_organization_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_actions_public_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestAccGithubActionsPublicKeyDataSource(t *testing.T) {
}

data "github_actions_public_key" "test" {
repository = github_repository.test.id
repository = github_repository.test.name
}
`, randomID)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestAccGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDataSour
config := fmt.Sprintf(`
resource "github_repository" "test" {
name = "tf-acc-test-%s"
private = true
visibility = "private"
}

resource "github_actions_repository_oidc_subject_claim_customization_template" "test" {
Expand All @@ -36,7 +36,7 @@ func TestAccGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDataSour
config3 := fmt.Sprintf(`
resource "github_repository" "test" {
name = "tf-acc-test-%s"
private = true
visibility = "private"
}

resource "github_actions_repository_oidc_subject_claim_customization_template" "test" {
Expand All @@ -61,7 +61,7 @@ func TestAccGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDataSour

check2 := resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.github_actions_repository_oidc_subject_claim_customization_template.test", "use_default", "true"),
resource.TestCheckNoResourceAttr("data.github_actions_repository_oidc_subject_claim_customization_template.test", "include_claim_keys"),
resource.TestCheckResourceAttr("data.github_actions_repository_oidc_subject_claim_customization_template.test", "include_claim_keys.#", "0"),
)

testCase := func(t *testing.T, mode string) {
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_actions_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_actions_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_app_token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"testing"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_branch.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/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_branch_protection_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestAccGithubBranchProtectionRulesDataSource(t *testing.T) {
}

resource "github_branch_protection" "protection" {
repository_id = github_repository.test.id
repository_id = github_repository.test.name
pattern = "main*"
}
`, randomID)
Expand Down
14 changes: 7 additions & 7 deletions github/data_source_github_branch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import (

func TestAccGithubBranchDataSource(t *testing.T) {

randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)

t.Run("queries an existing branch without error", func(t *testing.T) {
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)

config := fmt.Sprintf(`
resource "github_repository" "test" {
Expand All @@ -22,14 +21,14 @@ func TestAccGithubBranchDataSource(t *testing.T) {
}

data "github_branch" "test" {
repository = github_repository.test.id
repository = github_repository.test.name
branch = "main"
}
`, randomID)

check := resource.ComposeTestCheckFunc(
resource.TestMatchResourceAttr(
"data.github_branch.test", "id", regexp.MustCompile(randomID),
"data.github_branch.test", "ref", regexp.MustCompile("^refs/heads/main$"),
),
)

Expand Down Expand Up @@ -61,6 +60,7 @@ func TestAccGithubBranchDataSource(t *testing.T) {
})

t.Run("queries an invalid branch without error", func(t *testing.T) {
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)

config := fmt.Sprintf(`
resource "github_repository" "test" {
Expand All @@ -69,14 +69,14 @@ func TestAccGithubBranchDataSource(t *testing.T) {
}

data "github_branch" "test" {
repository = github_repository.test.id
repository = github_repository.test.name
branch = "xxxxxx"
}
`, randomID)

check := resource.ComposeTestCheckFunc(
resource.TestCheckNoResourceAttr(
"data.github_branch.test", "id",
resource.TestCheckResourceAttr(
"data.github_branch.test", "ref", "",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_codespaces_public_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestAccGithubCodespacesPublicKeyDataSource(t *testing.T) {
}

data "github_codespaces_public_key" "test" {
repository = github_repository.test.id
repository = github_repository.test.name
}
`, randomID)

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

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_codespaces_user_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_collaborators.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_dependabot_public_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestAccGithubDependabotPublicKeyDataSource(t *testing.T) {
}

data "github_actions_public_key" "test" {
repository = github_repository.test.id
repository = github_repository.test.name
}
`, randomID)

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

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_external_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"fmt"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

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

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

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

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/shurcooL/githubv4"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_organization_custom_role.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/v57/github"
"github.com/google/go-github/v62/github"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_organization_team_sync_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down
4 changes: 2 additions & 2 deletions github/data_source_github_organization_teams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func TestAccGithubOrganizationTeamsDataSource(t *testing.T) {
check := resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet("data.github_organization_teams.all", "teams.0.id"),
resource.TestCheckResourceAttrSet("data.github_organization_teams.all", "teams.0.node_id"),
resource.TestCheckNoResourceAttr("data.github_organization_teams.all", "teams.0.members"),
resource.TestCheckNoResourceAttr("data.github_organization_teams.all", "teams.0.repositories"),
resource.TestCheckNoResourceAttr("data.github_organization_teams.all", "teams.0.members.0"),
resource.TestCheckNoResourceAttr("data.github_organization_teams.all", "teams.0.repositories.0"),
)

testCase := func(t *testing.T, mode string) {
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_organization_webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_ref.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/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down
1 change: 1 addition & 0 deletions github/data_source_github_ref_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func TestAccGithubRefDataSource(t *testing.T) {

})

// TODO: This still fails on missing id attribute
t.Run("queries an invalid ref without error", func(t *testing.T) {

config := fmt.Sprintf(`
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

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 @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"
"strings"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

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

"github.com/google/go-github/v57/github"
"github.com/google/go-github/v62/github"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

Expand Down
Loading