diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4362bb2970..9cf5516865 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,8 +13,9 @@ Before submitting an issue or a pull request, please search the repository for e 1. Fork and clone the repository. 2. Create a new branch: `git switch -c my-branch-name`. 3. Make your change, add tests, and make sure the tests still pass. -4. Push to your fork and submit a pull request. -5. Pat yourself on the back and wait for your pull request to be reviewed and merged. +4. Run `make fmt; make lint; make tf-provider-lint` to check for formatting, linting, and provider linting errors. +5. Push to your fork and submit a pull request. +6. Pat yourself on the back and wait for your pull request to be reviewed and merged. Here are a few things you can do that will increase the likelihood of your pull request being accepted: @@ -33,9 +34,9 @@ This section describes a typical sequence performed when developing locally. Ful Once you have the repository cloned, there's a couple of additional steps you'll need to take. Since most of the testing is acceptance or integration testing, we need to manipulate real GitHub resources in order to run it. Useful setup steps are listed below: - If you haven't already, [create a GitHub organization you can use for testing](#github-organization). - - Optional: you may find it beneficial to create a test user as well in order to avoid potential rate-limiting issues on your main account. - - Your organization _must_ have a repository called `terraform-template-module`. The [terraformtesting/terraform-template-module](https://github.com/terraformtesting/terraform-template-module) repo is a good, re-usable example. - - You _must_ make sure that the "Template Repository" item in Settings is checked for this repo. + - Optional: you may find it beneficial to create a test user as well in order to avoid potential rate-limiting issues on your main account. + - Your organization _must_ have a repository called `terraform-template-module`. The [terraformtesting/terraform-template-module](https://github.com/terraformtesting/terraform-template-module) repo is a good, re-usable example. + - You _must_ make sure that the "Template Repository" item in Settings is checked for this repo. - If you haven't already, generate a Personal Access Token (PAT) for authenticating your test runs. - Export the necessary configuration for authenticating your provider with GitHub @@ -52,7 +53,7 @@ Once you have the repository cloned, there's a couple of additional steps you'll ### Local Development Iteration 1. Write a test describing what you will fix. See [`github_label`](./github/resource_github_issue_label_test.go) for an example format. -1. Run your test and observe it fail. Enabling debug output allows for observing the underlying requests and responses made as well as viewing state (search `STATE:`) generated during the acceptance test run. +2. Run your test and observe it fail. Enabling debug output allows for observing the underlying requests and responses made as well as viewing state (search `STATE:`) generated during the acceptance test run. ```sh TF_LOG=DEBUG TF_ACC=1 go test -v ./... -run ^TestAccGithubIssueLabel diff --git a/GNUmakefile b/GNUmakefile index 4d39de3b47..af2a56b8c0 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -30,6 +30,7 @@ default: build tools: go install github.com/client9/misspell/cmd/misspell@v0.3.4 go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.0 + go install github.com/bflad/tfproviderlint/cmd/tfproviderlintx@latest build: lintcheck CGO_ENABLED=0 go build -ldflags="-s -w" ./... @@ -46,6 +47,29 @@ lintcheck: @echo "==> Checking source code against linters..." golangci-lint run ./... +tf-provider-lint: + @branch=$$(git rev-parse --abbrev-ref HEAD); \ + printf "==> Running TF provider lint on branch: \033[1m%s\033[0m...\n" "🌿 $$branch 🌿"; + # Disabled linter rules: + # AT001: TestCase missing CheckDestroy - not yet adopted across all tests + # AT003: should use underscores in acc test names - not yet adopted across all tests + # AT004: provider declaration should be omitted - intentionally kept for provider configuration tests + # AT006: acc tests should not contain multiple resource.Test() invocations - not yet adopted across all tests + # XAT001: acceptance test should use ErrorCheck - not all resources support destroy verification + # XR003: resource should configure Timeouts - not yet adopted across all resources + # XR007: avoid os/exec.Command - intentionally used for GitHub CLI integration and ssh-keygen in tests + # XS002: schema should use keys in alphabetical order - not sure we want to enforce this + tfproviderlintx \ + -AT001=false \ + -AT003=false \ + -AT004=false \ + -AT006=false \ + -XAT001=false \ + -XR003=false \ + -XR007=false \ + -XS002=false \ + $(TEST) + test: @branch=$$(git rev-parse --abbrev-ref HEAD); \ printf "==> Running unit tests on branch: \033[1m%s\033[0m...\n" "🌿 $$branch 🌿" @@ -84,4 +108,4 @@ ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO))) endif @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME) -.PHONY: build test testacc fmt lint lintcheck tools website website-lint website-test sweep +.PHONY: build test testacc fmt lint lintcheck tools website website-lint website-test sweep tf-provider-lint diff --git a/github/data_source_github_actions_environment_public_key.go b/github/data_source_github_actions_environment_public_key.go index f36a411bbb..d5941f91d6 100644 --- a/github/data_source_github_actions_environment_public_key.go +++ b/github/data_source_github_actions_environment_public_key.go @@ -14,20 +14,24 @@ func dataSourceGithubActionsEnvironmentPublicKey() *schema.Resource { Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the repository.", }, "environment": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the environment.", }, "key_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The identifier for the key.", }, "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Base64 encoded public key.", }, }, } diff --git a/github/data_source_github_actions_environment_public_key_test.go b/github/data_source_github_actions_environment_public_key_test.go index 6bfbdbec2d..7b8f213afd 100644 --- a/github/data_source_github_actions_environment_public_key_test.go +++ b/github/data_source_github_actions_environment_public_key_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubActionsEnvironmentPublicKeyDataSource(t *testing.T) { t.Run("queries a repository environment public key without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-pubkey-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_actions_environment_secrets.go b/github/data_source_github_actions_environment_secrets.go index 9877756823..4764cd6d25 100644 --- a/github/data_source_github_actions_environment_secrets.go +++ b/github/data_source_github_actions_environment_secrets.go @@ -20,33 +20,40 @@ func dataSourceGithubActionsEnvironmentSecrets() *schema.Resource { Optional: true, Computed: true, ConflictsWith: []string{"name"}, + Description: "Full name of the repository (in org/name format).", }, "name": { Type: schema.TypeString, Optional: true, Computed: true, ConflictsWith: []string{"full_name"}, + Description: "The name of the repository.", }, "environment": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the environment.", }, "secrets": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of secrets for the environment.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the secret.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret last update.", }, }, }, diff --git a/github/data_source_github_actions_environment_secrets_test.go b/github/data_source_github_actions_environment_secrets_test.go index 4d9a826342..c13671c1fe 100644 --- a/github/data_source_github_actions_environment_secrets_test.go +++ b/github/data_source_github_actions_environment_secrets_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubActionsEnvironmentSecretsDataSource(t *testing.T) { t.Run("queries actions secrets from an environment", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-secrets-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_actions_environment_variables.go b/github/data_source_github_actions_environment_variables.go index 6accf9bf64..8136280b4a 100644 --- a/github/data_source_github_actions_environment_variables.go +++ b/github/data_source_github_actions_environment_variables.go @@ -20,37 +20,45 @@ func dataSourceGithubActionsEnvironmentVariables() *schema.Resource { Optional: true, Computed: true, ConflictsWith: []string{"name"}, + Description: "Full name of the repository (in org/name format).", }, "name": { Type: schema.TypeString, Optional: true, Computed: true, ConflictsWith: []string{"full_name"}, + Description: "The name of the repository.", }, "environment": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the environment.", }, "variables": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of variables for the environment.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the variable.", }, "value": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The value of the variable.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the variable creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the variable last update.", }, }, }, diff --git a/github/data_source_github_actions_environment_variables_test.go b/github/data_source_github_actions_environment_variables_test.go index c1fcdb6770..f608d78743 100644 --- a/github/data_source_github_actions_environment_variables_test.go +++ b/github/data_source_github_actions_environment_variables_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubActionsEnvironmentVariablesDataSource(t *testing.T) { t.Run("queries actions variables from an environment", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-vars-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_actions_organization_oidc_subject_claim_customization_template.go b/github/data_source_github_actions_organization_oidc_subject_claim_customization_template.go index 81e18c00b6..dc4be04108 100644 --- a/github/data_source_github_actions_organization_oidc_subject_claim_customization_template.go +++ b/github/data_source_github_actions_organization_oidc_subject_claim_customization_template.go @@ -6,12 +6,14 @@ import ( func dataSourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplate() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateRead, + Description: "Use this data source to retrieve the OpenID Connect subject claim customization template for an organization.", + Read: dataSourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateRead, Schema: map[string]*schema.Schema{ "include_claim_keys": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "A list of OpenID Connect claim keys.", Elem: &schema.Schema{ Type: schema.TypeString, }, diff --git a/github/data_source_github_actions_organization_public_key.go b/github/data_source_github_actions_organization_public_key.go index e8b57c1919..be7cc6f265 100644 --- a/github/data_source_github_actions_organization_public_key.go +++ b/github/data_source_github_actions_organization_public_key.go @@ -8,16 +8,19 @@ import ( func dataSourceGithubActionsOrganizationPublicKey() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubActionsOrganizationPublicKeyRead, + Description: "Use this data source to retrieve the public key for an organization's GitHub Actions secrets.", + Read: dataSourceGithubActionsOrganizationPublicKeyRead, Schema: map[string]*schema.Schema{ "key_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The identifier for the key.", }, "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Base64 encoded public key.", }, }, } diff --git a/github/data_source_github_actions_organization_registration_token.go b/github/data_source_github_actions_organization_registration_token.go index c7ee37a9c8..b8f9c2a315 100644 --- a/github/data_source_github_actions_organization_registration_token.go +++ b/github/data_source_github_actions_organization_registration_token.go @@ -10,16 +10,19 @@ import ( func dataSourceGithubActionsOrganizationRegistrationToken() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubActionsOrganizationRegistrationTokenRead, + Description: "Use this data source to retrieve a registration token for a GitHub Actions self-hosted runner in an organization.", + Read: dataSourceGithubActionsOrganizationRegistrationTokenRead, Schema: map[string]*schema.Schema{ "token": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The token that has been retrieved.", }, "expires_at": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The token expiration date as a Unix timestamp.", }, }, } diff --git a/github/data_source_github_actions_organization_secrets.go b/github/data_source_github_actions_organization_secrets.go index 98745882ed..249be0007b 100644 --- a/github/data_source_github_actions_organization_secrets.go +++ b/github/data_source_github_actions_organization_secrets.go @@ -10,29 +10,35 @@ import ( func dataSourceGithubActionsOrganizationSecrets() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubActionsOrganizationSecretsRead, + Description: "Use this data source to retrieve the list of secrets for a GitHub organization.", + Read: dataSourceGithubActionsOrganizationSecretsRead, Schema: map[string]*schema.Schema{ "secrets": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of secrets for the organization.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the secret.", }, "visibility": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The visibility of the secret (all, private, or selected).", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret last update.", }, }, }, diff --git a/github/data_source_github_actions_organization_secrets_test.go b/github/data_source_github_actions_organization_secrets_test.go index 93efd76961..778651d0da 100644 --- a/github/data_source_github_actions_organization_secrets_test.go +++ b/github/data_source_github_actions_organization_secrets_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubActionsOrganizationSecretsDataSource(t *testing.T) { t.Run("queries organization actions secrets from a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_actions_organization_secret" "test" { diff --git a/github/data_source_github_actions_organization_variables.go b/github/data_source_github_actions_organization_variables.go index d24add1afc..add561b273 100644 --- a/github/data_source_github_actions_organization_variables.go +++ b/github/data_source_github_actions_organization_variables.go @@ -10,33 +10,40 @@ import ( func dataSourceGithubActionsOrganizationVariables() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubActionsOrganizationVariablesRead, + Description: "Use this data source to retrieve the list of variables for a GitHub organization.", + Read: dataSourceGithubActionsOrganizationVariablesRead, Schema: map[string]*schema.Schema{ "variables": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of variables for the organization.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the variable.", }, "value": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The value of the variable.", }, "visibility": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The visibility of the variable (all, private, or selected).", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the variable creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the variable last update.", }, }, }, diff --git a/github/data_source_github_actions_organization_variables_test.go b/github/data_source_github_actions_organization_variables_test.go index e2bb495b42..455c18aa92 100644 --- a/github/data_source_github_actions_organization_variables_test.go +++ b/github/data_source_github_actions_organization_variables_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubActionsOrganizationVariablesDataSource(t *testing.T) { t.Run("queries actions variables from an organization", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_actions_organization_variable" "test" { diff --git a/github/data_source_github_actions_public_key.go b/github/data_source_github_actions_public_key.go index ce48001b39..0b541204e3 100644 --- a/github/data_source_github_actions_public_key.go +++ b/github/data_source_github_actions_public_key.go @@ -8,20 +8,24 @@ import ( func dataSourceGithubActionsPublicKey() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubActionsPublicKeyRead, + Description: "Use this data source to retrieve the public key for a repository's GitHub Actions secrets.", + Read: dataSourceGithubActionsPublicKeyRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the repository.", }, "key_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The identifier for the key.", }, "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Base64 encoded public key.", }, }, } diff --git a/github/data_source_github_actions_public_key_test.go b/github/data_source_github_actions_public_key_test.go index afcc960f50..5088fdfa83 100644 --- a/github/data_source_github_actions_public_key_test.go +++ b/github/data_source_github_actions_public_key_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccGithubActionsPublicKeyDataSource(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-actions-pubkey-%s", testResourcePrefix, randomID) t.Run("queries a repository public key without error", func(t *testing.T) { diff --git a/github/data_source_github_actions_registration_token.go b/github/data_source_github_actions_registration_token.go index 92cd4e4309..eb2d3bd81d 100644 --- a/github/data_source_github_actions_registration_token.go +++ b/github/data_source_github_actions_registration_token.go @@ -10,21 +10,24 @@ import ( func dataSourceGithubActionsRegistrationToken() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubActionsRegistrationTokenRead, + Description: "Use this data source to retrieve a registration token for a GitHub Actions self-hosted runner in a repository.", + Read: dataSourceGithubActionsRegistrationTokenRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the repository.", }, "token": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The token that has been retrieved.", }, "expires_at": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The token expiration date as a Unix timestamp.", }, }, } diff --git a/github/data_source_github_actions_registration_token_test.go b/github/data_source_github_actions_registration_token_test.go index b3e93a2f65..6bdfee0a05 100644 --- a/github/data_source_github_actions_registration_token_test.go +++ b/github/data_source_github_actions_registration_token_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccGithubActionsRegistrationTokenDataSource(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-actions-regtoken-%s", testResourcePrefix, randomID) t.Run("get a repository registration token without error", func(t *testing.T) { diff --git a/github/data_source_github_actions_repository_oidc_subject_claim_customization_template.go b/github/data_source_github_actions_repository_oidc_subject_claim_customization_template.go index 5e978064ec..b82c843f0b 100644 --- a/github/data_source_github_actions_repository_oidc_subject_claim_customization_template.go +++ b/github/data_source_github_actions_repository_oidc_subject_claim_customization_template.go @@ -4,20 +4,24 @@ import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" func dataSourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplate() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateRead, + Description: "Use this data source to retrieve the OpenID Connect subject claim customization template for a repository.", + Read: dataSourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateRead, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the repository.", }, "use_default": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository uses the default template.", }, "include_claim_keys": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "A list of OpenID Connect claim keys.", Elem: &schema.Schema{ Type: schema.TypeString, }, diff --git a/github/data_source_github_actions_repository_oidc_subject_claim_customization_template_test.go b/github/data_source_github_actions_repository_oidc_subject_claim_customization_template_test.go index b547ba1037..e50437ab73 100644 --- a/github/data_source_github_actions_repository_oidc_subject_claim_customization_template_test.go +++ b/github/data_source_github_actions_repository_oidc_subject_claim_customization_template_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDataSource(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-oidc-%s", testResourcePrefix, randomID) t.Run("get an repository oidc subject claim customization template without error", func(t *testing.T) { diff --git a/github/data_source_github_actions_secrets.go b/github/data_source_github_actions_secrets.go index 1acc61923c..e527a0e41f 100644 --- a/github/data_source_github_actions_secrets.go +++ b/github/data_source_github_actions_secrets.go @@ -11,7 +11,8 @@ import ( func dataSourceGithubActionsSecrets() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubActionsSecretsRead, + Description: "Use this data source to retrieve the list of secrets for a GitHub repository.", + Read: dataSourceGithubActionsSecretsRead, Schema: map[string]*schema.Schema{ "full_name": { @@ -19,29 +20,35 @@ func dataSourceGithubActionsSecrets() *schema.Resource { Optional: true, Computed: true, ConflictsWith: []string{"name"}, + Description: "Full name of the repository (in org/name format).", }, "name": { Type: schema.TypeString, Optional: true, Computed: true, ConflictsWith: []string{"full_name"}, + Description: "The name of the repository.", }, "secrets": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of secrets for the repository.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the secret.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret last update.", }, }, }, diff --git a/github/data_source_github_actions_secrets_test.go b/github/data_source_github_actions_secrets_test.go index e810d4a999..2ba3a93dfa 100644 --- a/github/data_source_github_actions_secrets_test.go +++ b/github/data_source_github_actions_secrets_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubActionsSecretsDataSource(t *testing.T) { t.Run("queries actions secrets from a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-actions-secrets-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_actions_variables.go b/github/data_source_github_actions_variables.go index 7b3b405f56..c46d5d4e82 100644 --- a/github/data_source_github_actions_variables.go +++ b/github/data_source_github_actions_variables.go @@ -11,7 +11,8 @@ import ( func dataSourceGithubActionsVariables() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubActionsVariablesRead, + Description: "Use this data source to retrieve the list of variables for a GitHub repository.", + Read: dataSourceGithubActionsVariablesRead, Schema: map[string]*schema.Schema{ "full_name": { @@ -19,33 +20,40 @@ func dataSourceGithubActionsVariables() *schema.Resource { Optional: true, Computed: true, ConflictsWith: []string{"name"}, + Description: "Full name of the repository (in org/name format).", }, "name": { Type: schema.TypeString, Optional: true, Computed: true, ConflictsWith: []string{"full_name"}, + Description: "The name of the repository.", }, "variables": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of variables for the repository.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the variable.", }, "value": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The value of the variable.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the variable creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the variable last update.", }, }, }, diff --git a/github/data_source_github_actions_variables_test.go b/github/data_source_github_actions_variables_test.go index 915a292a9f..747b91a481 100644 --- a/github/data_source_github_actions_variables_test.go +++ b/github/data_source_github_actions_variables_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubActionsVariablesDataSource(t *testing.T) { t.Run("queries actions variables from a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-actions-vars-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_app.go b/github/data_source_github_app.go index c2dcf3d366..2f8ce4fba1 100644 --- a/github/data_source_github_app.go +++ b/github/data_source_github_app.go @@ -9,24 +9,29 @@ import ( func dataSourceGithubApp() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubAppRead, + Description: "Use this data source to retrieve information about a GitHub App.", + Read: dataSourceGithubAppRead, Schema: map[string]*schema.Schema{ "slug": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The URL-friendly name of the GitHub App.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The app's description.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The app's full name.", }, "node_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Node ID of the app.", }, }, } diff --git a/github/data_source_github_app_token.go b/github/data_source_github_app_token.go index 69861e046b..f19ab86ce7 100644 --- a/github/data_source_github_app_token.go +++ b/github/data_source_github_app_token.go @@ -8,7 +8,8 @@ import ( func dataSourceGithubAppToken() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubAppTokenRead, + Description: "Use this data source to generate an installation access token for a GitHub App.", + Read: dataSourceGithubAppTokenRead, Schema: map[string]*schema.Schema{ "app_id": { diff --git a/github/data_source_github_app_token_test.go b/github/data_source_github_app_token_test.go index d107bc0fd3..e3d8dca920 100644 --- a/github/data_source_github_app_token_test.go +++ b/github/data_source_github_app_token_test.go @@ -48,10 +48,10 @@ func TestAccGithubAppTokenDataSource(t *testing.T) { } testSchema := map[string]*schema.Schema{ - "app_id": {Type: schema.TypeString}, - "installation_id": {Type: schema.TypeString}, - "pem_file": {Type: schema.TypeString}, - "token": {Type: schema.TypeString}, + "app_id": {Type: schema.TypeString, Required: true, Description: "The GitHub App ID."}, + "installation_id": {Type: schema.TypeString, Required: true, Description: "The GitHub App installation instance ID."}, + "pem_file": {Type: schema.TypeString, Required: true, Description: "The content of the GitHub App PEM file."}, + "token": {Type: schema.TypeString, Computed: true, Description: "The generated GitHub App installation access token."}, } schema := schema.TestResourceDataRaw(t, testSchema, map[string]any{ diff --git a/github/data_source_github_branch.go b/github/data_source_github_branch.go index 649c5b12af..72433ea60c 100644 --- a/github/data_source_github_branch.go +++ b/github/data_source_github_branch.go @@ -12,30 +12,34 @@ import ( func dataSourceGithubBranch() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubBranchRead, + Description: "Use this data source to retrieve information about a branch in a repository.", + Read: dataSourceGithubBranchRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + Description: "The GitHub repository name.", }, "branch": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + Description: "The repository branch to retrieve.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the branch object.", }, "ref": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A string representing a branch reference, in the form of refs/heads/.", }, "sha": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The SHA1 of the branch HEAD commit.", }, }, } @@ -67,11 +71,11 @@ func dataSourceGithubBranchRead(d *schema.ResourceData, meta any) error { if err != nil { return err } - err = d.Set("ref", *ref.Ref) + err = d.Set("ref", ref.Ref) if err != nil { return err } - err = d.Set("sha", *ref.Object.SHA) + err = d.Set("sha", ref.Object.SHA) if err != nil { return err } diff --git a/github/data_source_github_branch_protection_rules.go b/github/data_source_github_branch_protection_rules.go index 5b800f469d..7018dca108 100644 --- a/github/data_source_github_branch_protection_rules.go +++ b/github/data_source_github_branch_protection_rules.go @@ -7,21 +7,25 @@ import ( func dataSourceGithubBranchProtectionRules() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubBranchProtectionRulesRead, + Description: "Use this data source to retrieve the branch protection rules for a repository.", + Read: dataSourceGithubBranchProtectionRulesRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The GitHub repository name.", }, "rules": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "Collection of branch protection rules.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "pattern": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Identifies the protection rule pattern.", }, }, }, diff --git a/github/data_source_github_branch_protection_rules_test.go b/github/data_source_github_branch_protection_rules_test.go index f0c2ce5946..ec7e5d9503 100644 --- a/github/data_source_github_branch_protection_rules_test.go +++ b/github/data_source_github_branch_protection_rules_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubBranchProtectionRulesDataSource(t *testing.T) { t.Run("queries branch protection rules without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-bp-rules-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -41,7 +41,7 @@ func TestAccGithubBranchProtectionRulesDataSource(t *testing.T) { }) t.Run("queries branch protection", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-bp-rules2-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_branch_test.go b/github/data_source_github_branch_test.go index 6958629294..1ca2b2f1be 100644 --- a/github/data_source_github_branch_test.go +++ b/github/data_source_github_branch_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubBranchDataSource(t *testing.T) { t.Run("queries an existing branch without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-branch-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -46,7 +46,7 @@ func TestAccGithubBranchDataSource(t *testing.T) { // Can't test due to SDK and test framework limitations // t.Run("queries an invalid branch without error", func(t *testing.T) { - // randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + // randomID := acctest.RandString(5) // repoName := fmt.Sprintf("%sinvalid-branch-%s", testResourcePrefix, randomID) // config := fmt.Sprintf(` diff --git a/github/data_source_github_codespaces_organization_public_key.go b/github/data_source_github_codespaces_organization_public_key.go index 22103cd3e2..e23effc99b 100644 --- a/github/data_source_github_codespaces_organization_public_key.go +++ b/github/data_source_github_codespaces_organization_public_key.go @@ -8,16 +8,19 @@ import ( func dataSourceGithubCodespacesOrganizationPublicKey() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubCodespacesOrganizationPublicKeyRead, + Description: "Use this data source to retrieve the public key for an organization's Codespaces secrets.", + Read: dataSourceGithubCodespacesOrganizationPublicKeyRead, Schema: map[string]*schema.Schema{ "key_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The identifier for the key.", }, "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Base64 encoded public key.", }, }, } diff --git a/github/data_source_github_codespaces_organization_secrets.go b/github/data_source_github_codespaces_organization_secrets.go index bd3ad291c0..1afd4c29c0 100644 --- a/github/data_source_github_codespaces_organization_secrets.go +++ b/github/data_source_github_codespaces_organization_secrets.go @@ -10,29 +10,35 @@ import ( func dataSourceGithubCodespacesOrganizationSecrets() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubCodespacesOrganizationSecretsRead, + Description: "Use this data source to retrieve the list of Codespaces secrets for an organization.", + Read: dataSourceGithubCodespacesOrganizationSecretsRead, Schema: map[string]*schema.Schema{ "secrets": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of Codespaces secrets for the organization.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the secret.", }, "visibility": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The visibility of the secret (all, private, or selected).", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret last update.", }, }, }, diff --git a/github/data_source_github_codespaces_organization_secrets_test.go b/github/data_source_github_codespaces_organization_secrets_test.go index b340978f04..cbc9f3f88f 100644 --- a/github/data_source_github_codespaces_organization_secrets_test.go +++ b/github/data_source_github_codespaces_organization_secrets_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubCodespacesOrganizationSecretsDataSource(t *testing.T) { t.Run("queries organization codespaces secrets from a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) secretName := fmt.Sprintf("ORG_CS_SECRET_1_%s", randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_codespaces_public_key.go b/github/data_source_github_codespaces_public_key.go index 5d2278af93..15c3652d2d 100644 --- a/github/data_source_github_codespaces_public_key.go +++ b/github/data_source_github_codespaces_public_key.go @@ -9,20 +9,24 @@ import ( func dataSourceGithubCodespacesPublicKey() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubCodespacesPublicKeyRead, + Description: "Use this data source to retrieve the public key for a repository's Codespaces secrets.", + Read: dataSourceGithubCodespacesPublicKeyRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the repository.", }, "key_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The identifier for the key.", }, "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Base64 encoded public key.", }, }, } diff --git a/github/data_source_github_codespaces_public_key_test.go b/github/data_source_github_codespaces_public_key_test.go index 5848b8f3c6..5fb837b1a3 100644 --- a/github/data_source_github_codespaces_public_key_test.go +++ b/github/data_source_github_codespaces_public_key_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccGithubCodespacesPublicKeyDataSource(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-cs-pubkey-%s", testResourcePrefix, randomID) t.Run("queries a repository public key without error", func(t *testing.T) { diff --git a/github/data_source_github_codespaces_secrets.go b/github/data_source_github_codespaces_secrets.go index 5d9a4b37b8..12a170c879 100644 --- a/github/data_source_github_codespaces_secrets.go +++ b/github/data_source_github_codespaces_secrets.go @@ -11,7 +11,8 @@ import ( func dataSourceGithubCodespacesSecrets() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubCodespacesSecretsRead, + Description: "Use this data source to retrieve the list of Codespaces secrets for a repository.", + Read: dataSourceGithubCodespacesSecretsRead, Schema: map[string]*schema.Schema{ "full_name": { @@ -29,21 +30,25 @@ func dataSourceGithubCodespacesSecrets() *schema.Resource { Description: "The name of the repository.", }, "secrets": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of Codespaces secrets for the repository.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the secret.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret last update.", }, }, }, diff --git a/github/data_source_github_codespaces_secrets_test.go b/github/data_source_github_codespaces_secrets_test.go index 0bd8e37479..e2d3acd74a 100644 --- a/github/data_source_github_codespaces_secrets_test.go +++ b/github/data_source_github_codespaces_secrets_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubCodespacesSecretsDataSource(t *testing.T) { t.Run("queries codespaces secrets from a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-cs-secrets-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_codespaces_user_public_key.go b/github/data_source_github_codespaces_user_public_key.go index 75dec30f2b..29fa320c1c 100644 --- a/github/data_source_github_codespaces_user_public_key.go +++ b/github/data_source_github_codespaces_user_public_key.go @@ -8,16 +8,19 @@ import ( func dataSourceGithubCodespacesUserPublicKey() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubCodespacesUserPublicKeyRead, + Description: "Use this data source to retrieve the public key for a user's Codespaces secrets.", + Read: dataSourceGithubCodespacesUserPublicKeyRead, Schema: map[string]*schema.Schema{ "key_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The identifier for the key.", }, "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Base64 encoded public key.", }, }, } diff --git a/github/data_source_github_codespaces_user_secrets.go b/github/data_source_github_codespaces_user_secrets.go index b4459c2943..6953c0bfe6 100644 --- a/github/data_source_github_codespaces_user_secrets.go +++ b/github/data_source_github_codespaces_user_secrets.go @@ -10,29 +10,35 @@ import ( func dataSourceGithubCodespacesUserSecrets() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubCodespacesUserSecretsRead, + Description: "Use this data source to retrieve the list of Codespaces secrets for a user.", + Read: dataSourceGithubCodespacesUserSecretsRead, Schema: map[string]*schema.Schema{ "secrets": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of Codespaces secrets for the user.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the secret.", }, "visibility": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The visibility of the secret (all, private, or selected).", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret last update.", }, }, }, diff --git a/github/data_source_github_codespaces_user_secrets_test.go b/github/data_source_github_codespaces_user_secrets_test.go index 483f82a83b..c64d89e61d 100644 --- a/github/data_source_github_codespaces_user_secrets_test.go +++ b/github/data_source_github_codespaces_user_secrets_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubCodespacesUserSecretsDataSource(t *testing.T) { t.Run("queries user codespaces secrets from a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_codespaces_user_secret" "test" { diff --git a/github/data_source_github_collaborators.go b/github/data_source_github_collaborators.go index caa14d6e14..1486766757 100644 --- a/github/data_source_github_collaborators.go +++ b/github/data_source_github_collaborators.go @@ -11,19 +11,23 @@ import ( func dataSourceGithubCollaborators() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubCollaboratorsRead, + Description: "Use this data source to retrieve the collaborators for a repository.", + Read: dataSourceGithubCollaboratorsRead, Schema: map[string]*schema.Schema{ "owner": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The organization that owns the repository.", }, "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the repository.", }, "affiliation": { - Type: schema.TypeString, + Type: schema.TypeString, + Description: "Filter collaborators returned by their affiliation. Can be one of: outside, direct, all. Defaults to all.", ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{ "all", "direct", @@ -33,7 +37,8 @@ func dataSourceGithubCollaborators() *schema.Resource { Default: "all", }, "permission": { - Type: schema.TypeString, + Type: schema.TypeString, + Description: "Filter collaborators returned by their permission. Can be one of: pull, triage, push, maintain, admin.", ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{ "pull", "triage", @@ -45,73 +50,90 @@ func dataSourceGithubCollaborators() *schema.Resource { Default: "", }, "collaborator": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of collaborators for the repository.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "login": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The collaborator's login.", }, "id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the collaborator.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub API URL for the collaborator.", }, "html_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub HTML URL for the collaborator.", }, "followers_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub API URL for the collaborator's followers.", }, "following_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub API URL for those following the collaborator.", }, "gists_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub API URL for the collaborator's gists.", }, "starred_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub API URL for the collaborator's starred repositories.", }, "subscriptions_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub API URL for the collaborator's subscribed repositories.", }, "organizations_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub API URL for the collaborator's organizations.", }, "repos_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub API URL for the collaborator's repositories.", }, "events_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub API URL for the collaborator's events.", }, "received_events_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub API URL for the collaborator's received events.", }, "type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The type of the collaborator (e.g., user).", }, "site_admin": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the user is a GitHub admin.", }, "permission": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The permission of the collaborator.", }, }, }, diff --git a/github/data_source_github_dependabot_organization_public_key.go b/github/data_source_github_dependabot_organization_public_key.go index abef9af875..faa37a35ac 100644 --- a/github/data_source_github_dependabot_organization_public_key.go +++ b/github/data_source_github_dependabot_organization_public_key.go @@ -8,16 +8,19 @@ import ( func dataSourceGithubDependabotOrganizationPublicKey() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubDependabotOrganizationPublicKeyRead, + Description: "Use this data source to retrieve the public key for an organization's Dependabot secrets.", + Read: dataSourceGithubDependabotOrganizationPublicKeyRead, Schema: map[string]*schema.Schema{ "key_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The identifier for the key.", }, "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Base64 encoded public key.", }, }, } diff --git a/github/data_source_github_dependabot_organization_secrets.go b/github/data_source_github_dependabot_organization_secrets.go index 7b0832c135..73996754b9 100644 --- a/github/data_source_github_dependabot_organization_secrets.go +++ b/github/data_source_github_dependabot_organization_secrets.go @@ -10,29 +10,35 @@ import ( func dataSourceGithubDependabotOrganizationSecrets() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubDependabotOrganizationSecretsRead, + Description: "Use this data source to retrieve the list of Dependabot secrets for an organization.", + Read: dataSourceGithubDependabotOrganizationSecretsRead, Schema: map[string]*schema.Schema{ "secrets": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of Dependabot secrets for the organization.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the secret.", }, "visibility": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The visibility of the secret (all, private, or selected).", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret last update.", }, }, }, diff --git a/github/data_source_github_dependabot_organization_secrets_test.go b/github/data_source_github_dependabot_organization_secrets_test.go index 6b72579982..ceed917410 100644 --- a/github/data_source_github_dependabot_organization_secrets_test.go +++ b/github/data_source_github_dependabot_organization_secrets_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubDependabotOrganizationSecretsDataSource(t *testing.T) { t.Run("queries organization dependabot secrets from a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_dependabot_organization_secret" "test" { diff --git a/github/data_source_github_dependabot_public_key.go b/github/data_source_github_dependabot_public_key.go index 618c4b1815..0b7d91c997 100644 --- a/github/data_source_github_dependabot_public_key.go +++ b/github/data_source_github_dependabot_public_key.go @@ -9,20 +9,24 @@ import ( func dataSourceGithubDependabotPublicKey() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubDependabotPublicKeyRead, + Description: "Use this data source to retrieve the public key for a repository's Dependabot secrets.", + Read: dataSourceGithubDependabotPublicKeyRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the repository.", }, "key_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The identifier for the key.", }, "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Base64 encoded public key.", }, }, } diff --git a/github/data_source_github_dependabot_public_key_test.go b/github/data_source_github_dependabot_public_key_test.go index 24ae804bb9..84e5bc388b 100644 --- a/github/data_source_github_dependabot_public_key_test.go +++ b/github/data_source_github_dependabot_public_key_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccGithubDependabotPublicKeyDataSource(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-dep-pubkey-%s", testResourcePrefix, randomID) t.Run("queries a repository public key without error", func(t *testing.T) { diff --git a/github/data_source_github_dependabot_secrets.go b/github/data_source_github_dependabot_secrets.go index 1f053c8c6c..36bb5820f4 100644 --- a/github/data_source_github_dependabot_secrets.go +++ b/github/data_source_github_dependabot_secrets.go @@ -11,7 +11,8 @@ import ( func dataSourceGithubDependabotSecrets() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubDependabotSecretsRead, + Description: "Use this data source to retrieve the list of Dependabot secrets for a repository.", + Read: dataSourceGithubDependabotSecretsRead, Schema: map[string]*schema.Schema{ "full_name": { @@ -19,29 +20,35 @@ func dataSourceGithubDependabotSecrets() *schema.Resource { Optional: true, Computed: true, ConflictsWith: []string{"name"}, + Description: "Full name of the repository (in org/name format).", }, "name": { Type: schema.TypeString, Optional: true, Computed: true, ConflictsWith: []string{"full_name"}, + Description: "The name of the repository.", }, "secrets": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of Dependabot secrets for the repository.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the secret.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret creation.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Timestamp of the secret last update.", }, }, }, diff --git a/github/data_source_github_dependabot_secrets_test.go b/github/data_source_github_dependabot_secrets_test.go index 646aea04da..a58b29c1f0 100644 --- a/github/data_source_github_dependabot_secrets_test.go +++ b/github/data_source_github_dependabot_secrets_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubDependabotSecretsDataSource(t *testing.T) { t.Run("queries dependabot secrets from a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-dep-secrets-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_enterprise.go b/github/data_source_github_enterprise.go index 0d5a47de6d..7dccbd9d21 100644 --- a/github/data_source_github_enterprise.go +++ b/github/data_source_github_enterprise.go @@ -10,31 +10,38 @@ import ( func dataSourceGithubEnterprise() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubEnterpriseRead, + Description: "Use this data source to retrieve information about a GitHub Enterprise.", + Read: dataSourceGithubEnterpriseRead, Schema: map[string]*schema.Schema{ "database_id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The database ID of the enterprise.", }, "slug": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The URL slug identifying the enterprise.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the enterprise.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The description of the enterprise.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The time the enterprise was created.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL for the enterprise.", }, }, } diff --git a/github/data_source_github_external_groups.go b/github/data_source_github_external_groups.go index 04a7bdb33f..12f3ef64c7 100644 --- a/github/data_source_github_external_groups.go +++ b/github/data_source_github_external_groups.go @@ -11,24 +11,29 @@ import ( func dataSourceGithubExternalGroups() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubExternalGroupsRead, + Description: "Use this data source to retrieve the external groups for an organization.", + Read: dataSourceGithubExternalGroupsRead, Schema: map[string]*schema.Schema{ "external_groups": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "An array of external groups belonging to the organization.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "group_id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the group.", }, "group_name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the group.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The date the group was last updated.", }, }, }, diff --git a/github/data_source_github_ip_ranges.go b/github/data_source_github_ip_ranges.go index b208ff482c..b0bcf83050 100644 --- a/github/data_source_github_ip_ranges.go +++ b/github/data_source_github_ip_ranges.go @@ -13,142 +13,169 @@ func dataSourceGithubIpRanges() *schema.Resource { Read: dataSourceGithubIpRangesRead, Schema: map[string]*schema.Schema{ "hooks": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "An array of IP addresses in CIDR format specifying the addresses that incoming service hooks will originate from.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "git": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "An array of IP addresses in CIDR format specifying the Git servers.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "web": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "An array of IP addresses in CIDR format for GitHub Web.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "api": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "An array of IP addresses in CIDR format for the GitHub API.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "packages": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "An array of IP addresses in CIDR format specifying the addresses for GitHub Packages.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "pages": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "An array of IP addresses in CIDR format specifying the addresses for GitHub Pages.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "importer": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "An array of IP addresses in CIDR format specifying the addresses for GitHub Importer.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "actions": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "An array of IP addresses in CIDR format specifying the addresses that incoming requests from GitHub Actions will originate from.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "dependabot": { - Deprecated: "This attribute is no longer returned form the API, Dependabot now uses the GitHub Actions IP addresses.", - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Deprecated: "This attribute is no longer returned form the API, Dependabot now uses the GitHub Actions IP addresses.", + Type: schema.TypeList, + Computed: true, + Description: "An array of IP addresses in CIDR format specifying the addresses for Dependabot.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "hooks_ipv4": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the hooks array that contains IP addresses in IPv4 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "git_ipv4": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the git array that contains IP addresses in IPv4 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "web_ipv4": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the web array that contains IP addresses in IPv4 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "api_ipv4": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the api array that contains IP addresses in IPv4 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "packages_ipv4": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the packages array that contains IP addresses in IPv4 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "pages_ipv4": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the pages array that contains IP addresses in IPv4 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "importer_ipv4": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the importer array that contains IP addresses in IPv4 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "actions_ipv4": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the actions array that contains IP addresses in IPv4 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "dependabot_ipv4": { - Deprecated: "This attribute is no longer returned form the API, Dependabot now uses the GitHub Actions IP addresses.", - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Deprecated: "This attribute is no longer returned form the API, Dependabot now uses the GitHub Actions IP addresses.", + Type: schema.TypeList, + Computed: true, + Description: "A subset of the dependabot array that contains IP addresses in IPv4 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "hooks_ipv6": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the hooks array that contains IP addresses in IPv6 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "git_ipv6": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the git array that contains IP addresses in IPv6 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "web_ipv6": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the web array that contains IP addresses in IPv6 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "api_ipv6": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the api array that contains IP addresses in IPv6 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "packages_ipv6": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the packages array that contains IP addresses in IPv6 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "pages_ipv6": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the pages array that contains IP addresses in IPv6 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "importer_ipv6": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the importer array that contains IP addresses in IPv6 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "actions_ipv6": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Description: "A subset of the actions array that contains IP addresses in IPv6 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, "dependabot_ipv6": { - Deprecated: "This attribute is no longer returned form the API, Dependabot now uses the GitHub Actions IP addresses.", - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Deprecated: "This attribute is no longer returned form the API, Dependabot now uses the GitHub Actions IP addresses.", + Type: schema.TypeList, + Computed: true, + Description: "A subset of the dependabot array that contains IP addresses in IPv6 CIDR format.", + Elem: &schema.Schema{Type: schema.TypeString}, }, }, } diff --git a/github/data_source_github_issue_labels.go b/github/data_source_github_issue_labels.go index 24f59e15ba..40e92d0aaf 100644 --- a/github/data_source_github_issue_labels.go +++ b/github/data_source_github_issue_labels.go @@ -8,33 +8,40 @@ import ( func dataSourceGithubIssueLabels() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubIssueLabelsRead, + Description: "Use this data source to retrieve the labels for a repository.", + Read: dataSourceGithubIssueLabelsRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the repository.", }, "labels": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The list of this repository's labels.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the label.", }, "color": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The hexadecimal color code for the label, without the leading #.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A short description of the label.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL of the label.", }, }, }, diff --git a/github/data_source_github_issue_labels_test.go b/github/data_source_github_issue_labels_test.go index bd996d3f27..dbc0464a3b 100644 --- a/github/data_source_github_issue_labels_test.go +++ b/github/data_source_github_issue_labels_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubIssueLabelsDataSource(t *testing.T) { t.Run("queries the labels for a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-issue-labels-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_membership.go b/github/data_source_github_membership.go index f34459876d..486375fed2 100644 --- a/github/data_source_github_membership.go +++ b/github/data_source_github_membership.go @@ -8,28 +8,34 @@ import ( func dataSourceGithubMembership() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubMembershipRead, + Description: "Use this data source to retrieve information about a user's membership in an organization.", + Read: dataSourceGithubMembershipRead, Schema: map[string]*schema.Schema{ "username": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The username to lookup in the organization.", }, "organization": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "The organization to check for the above username.", }, "role": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The role the user has within the organization. Can be 'admin' or 'member'.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the membership object.", }, "state": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The state of the user's membership in the organization. Can be 'active' or 'pending'.", }, }, } diff --git a/github/data_source_github_organization.go b/github/data_source_github_organization.go index 8742f93940..0ac828db94 100644 --- a/github/data_source_github_organization.go +++ b/github/data_source_github_organization.go @@ -10,56 +10,67 @@ import ( func dataSourceGithubOrganization() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubOrganizationRead, + Description: "Use this data source to retrieve information about a GitHub organization.", + Read: dataSourceGithubOrganizationRead, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the organization.", }, "ignore_archived_repos": { - Type: schema.TypeBool, - Default: false, - Optional: true, + Type: schema.TypeBool, + Default: false, + Optional: true, + Description: "Whether or not to include archived repos in the repositories list.", }, "orgname": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The organization's name as used in URLs and the API.", }, "node_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "GraphQL global node ID for use with the v4 API.", }, "login": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The organization account login.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The organization account description.", }, "plan": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The organization account plan name.", }, "repositories": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "A list of the full names of the repositories in the organization.", Elem: &schema.Schema{ Type: schema.TypeString, }, }, "members": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "A list of the organization's members.", Elem: &schema.Schema{ Type: schema.TypeString, }, Deprecated: "Use `users` instead by replacing `github_organization.example.members` to `github_organization.example.users[*].login`. Expect this field to be removed in next major version.", }, "users": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "A list with the members of the organization containing their id, login, email, and role.", Elem: &schema.Schema{ Type: schema.TypeMap, Elem: &schema.Schema{ @@ -68,81 +79,100 @@ func dataSourceGithubOrganization() *schema.Resource { }, }, "default_repository_permission": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Default permission level members have for organization repositories.", }, "members_can_create_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether non-admin organization members can create repositories.", }, "two_factor_requirement_enabled": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether two-factor authentication is required for all members of the organization.", }, "members_allowed_repository_creation_type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The type of repository allowed to be created by members of the organization.", }, "members_can_create_public_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether organization members can create public repositories.", }, "members_can_create_private_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether organization members can create private repositories.", }, "members_can_create_internal_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether organization members can create internal repositories.", }, "members_can_create_pages": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether organization members can create pages sites.", }, "members_can_create_public_pages": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether organization members can create public pages sites.", }, "members_can_create_private_pages": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether organization members can create private pages sites.", }, "members_can_fork_private_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether organization members can fork private repositories.", }, "web_commit_signoff_required": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether organization members must sign all commits.", }, "advanced_security_enabled_for_new_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether advanced security is enabled for new repositories.", }, "dependabot_alerts_enabled_for_new_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether Dependabot alerts is automatically enabled for new repositories.", }, "dependabot_security_updates_enabled_for_new_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether Dependabot security updates is automatically enabled for new repositories.", }, "dependency_graph_enabled_for_new_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether dependency graph is automatically enabled for new repositories.", }, "secret_scanning_enabled_for_new_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether secret scanning is automatically enabled for new repositories.", }, "secret_scanning_push_protection_enabled_for_new_repositories": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether secret scanning push protection is automatically enabled for new repositories.", }, "summary_only": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Exclude the repos, members and other attributes from the returned result.", }, }, } diff --git a/github/data_source_github_organization_custom_properties.go b/github/data_source_github_organization_custom_properties.go index dd9aadd42c..c6cb6e1755 100644 --- a/github/data_source_github_organization_custom_properties.go +++ b/github/data_source_github_organization_custom_properties.go @@ -9,41 +9,49 @@ import ( func dataSourceGithubOrganizationCustomProperties() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubOrganizationCustomPropertiesRead, + Description: "Use this data source to retrieve information about an organization's custom property.", + Read: dataSourceGithubOrganizationCustomPropertiesRead, Schema: map[string]*schema.Schema{ "property_name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the custom property.", }, "value_type": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "The type of the custom property. Can be one of 'string', 'single_select', 'multi_select', or 'true_false'.", }, "required": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: "Whether the custom property is required.", }, "default_value": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The default value of the custom property.", }, "description": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "The description of the custom property.", }, "allowed_values": { - Type: schema.TypeList, - Optional: true, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "List of allowed values for the custom property. Only populated when value_type is 'single_select' or 'multi_select'.", }, "values_editable_by": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Who can edit the values of the custom property. Can be one of 'org_actors' or 'org_and_repo_actors'.", }, }, } diff --git a/github/data_source_github_organization_custom_role.go b/github/data_source_github_organization_custom_role.go index 760af74ebb..93bbd5b8a6 100644 --- a/github/data_source_github_organization_custom_role.go +++ b/github/data_source_github_organization_custom_role.go @@ -12,26 +12,31 @@ import ( func dataSourceGithubOrganizationCustomRole() *schema.Resource { return &schema.Resource{ + Description: "Use this data source to retrieve information about an organization's custom role.", DeprecationMessage: "This data source is deprecated and will be removed in a future release. Use the github_organization_repository_role data source instead.", Read: dataSourceGithubOrganizationCustomRoleRead, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the custom role.", }, "base_role": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The system role from which the role inherits permissions.", }, "permissions": { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "A list of additional permissions included in this role.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The description for the custom role.", }, }, } diff --git a/github/data_source_github_organization_custom_role_test.go b/github/data_source_github_organization_custom_role_test.go index c3a7048c93..a4c32ef4f4 100644 --- a/github/data_source_github_organization_custom_role_test.go +++ b/github/data_source_github_organization_custom_role_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubOrganizationCustomRoleDataSource(t *testing.T) { t.Run("queries a custom repo role", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testResourceName := fmt.Sprintf("%sorg-custom-role-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_organization_external_identities.go b/github/data_source_github_organization_external_identities.go index c70647fe49..dca9e8986c 100644 --- a/github/data_source_github_organization_external_identities.go +++ b/github/data_source_github_organization_external_identities.go @@ -32,28 +32,33 @@ type ExternalIdentities struct { func dataSourceGithubOrganizationExternalIdentities() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubOrganizationExternalIdentitiesRead, + Description: "Use this data source to retrieve the external identities (SAML/SCIM) for an organization.", + Read: dataSourceGithubOrganizationExternalIdentitiesRead, Schema: map[string]*schema.Schema{ "identities": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "An array of identities returned from GitHub.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "login": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The username of the GitHub user.", }, "saml_identity": { - Type: schema.TypeMap, - Computed: true, + Type: schema.TypeMap, + Computed: true, + Description: "An object containing the user's SAML data. This object will be empty if the user is not managed by SAML.", Elem: &schema.Schema{ Type: schema.TypeString, }, }, "scim_identity": { - Type: schema.TypeMap, - Computed: true, + Type: schema.TypeMap, + Computed: true, + Description: "An object containing the user's SCIM data. This object will be empty if the user is not managed by SCIM.", Elem: &schema.Schema{ Type: schema.TypeString, }, diff --git a/github/data_source_github_organization_ip_allow_list.go b/github/data_source_github_organization_ip_allow_list.go index ddcd233a33..e40ccf167e 100644 --- a/github/data_source_github_organization_ip_allow_list.go +++ b/github/data_source_github_organization_ip_allow_list.go @@ -9,37 +9,45 @@ import ( func dataSourceGithubOrganizationIpAllowList() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubOrganizationIpAllowListRead, + Description: "Use this data source to retrieve the IP allow list for an organization.", + Read: dataSourceGithubOrganizationIpAllowListRead, Schema: map[string]*schema.Schema{ "ip_allow_list": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "An array of allowed IP addresses.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The ID of the IP allow list entry.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the IP allow list entry.", }, "allow_list_value": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A single IP address or range of IP addresses in CIDR notation.", }, "is_active": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the entry is currently active.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Identifies the date and time when the object was created.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Identifies the date and time when the object was last updated.", }, }, }, diff --git a/github/data_source_github_organization_repository_role.go b/github/data_source_github_organization_repository_role.go index 66ef09aef5..779befaaa8 100644 --- a/github/data_source_github_organization_repository_role.go +++ b/github/data_source_github_organization_repository_role.go @@ -75,20 +75,22 @@ func dataSourceGithubOrganizationRepositoryRoleRead(ctx context.Context, d *sche return diag.FromErr(fmt.Errorf("custom organization repo role with ID %d not found", roleId)) } - r := map[string]any{ - "role_id": role.GetID(), - "name": role.GetName(), - "description": role.GetDescription(), - "base_role": role.GetBaseRole(), - "permissions": role.Permissions, - } - d.SetId(strconv.FormatInt(role.GetID(), 10)) - for k, v := range r { - if err := d.Set(k, v); err != nil { - return diag.FromErr(err) - } + if err := d.Set("role_id", role.GetID()); err != nil { + return diag.FromErr(err) + } + if err := d.Set("name", role.GetName()); err != nil { + return diag.FromErr(err) + } + if err := d.Set("description", role.GetDescription()); err != nil { + return diag.FromErr(err) + } + if err := d.Set("base_role", role.GetBaseRole()); err != nil { + return diag.FromErr(err) + } + if err := d.Set("permissions", role.Permissions); err != nil { + return diag.FromErr(err) } return nil diff --git a/github/data_source_github_organization_repository_role_test.go b/github/data_source_github_organization_repository_role_test.go index 3367d51356..0f91b430a9 100644 --- a/github/data_source_github_organization_repository_role_test.go +++ b/github/data_source_github_organization_repository_role_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubOrganizationRepositoryRoleDataSource(t *testing.T) { t.Run("queries an organization repository role", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) roleName := fmt.Sprintf(`tf-acc-test-%s`, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_organization_role.go b/github/data_source_github_organization_role.go index 5719aab593..a3d998ef40 100644 --- a/github/data_source_github_organization_role.go +++ b/github/data_source_github_organization_role.go @@ -61,21 +61,25 @@ func dataSourceGithubOrganizationRoleRead(ctx context.Context, d *schema.Resourc return diag.FromErr(err) } - r := map[string]any{ - "role_id": int(role.GetID()), - "name": role.GetName(), - "description": role.GetDescription(), - "source": role.GetSource(), - "base_role": role.GetBaseRole(), - "permissions": role.Permissions, - } - d.SetId(strconv.FormatInt(role.GetID(), 10)) - for k, v := range r { - if err := d.Set(k, v); err != nil { - return diag.FromErr(err) - } + if err := d.Set("role_id", int(role.GetID())); err != nil { + return diag.FromErr(err) + } + if err := d.Set("name", role.GetName()); err != nil { + return diag.FromErr(err) + } + if err := d.Set("description", role.GetDescription()); err != nil { + return diag.FromErr(err) + } + if err := d.Set("source", role.GetSource()); err != nil { + return diag.FromErr(err) + } + if err := d.Set("base_role", role.GetBaseRole()); err != nil { + return diag.FromErr(err) + } + if err := d.Set("permissions", role.Permissions); err != nil { + return diag.FromErr(err) } return nil diff --git a/github/data_source_github_organization_role_teams_test.go b/github/data_source_github_organization_role_teams_test.go index c37db7eb05..3439bdcf51 100644 --- a/github/data_source_github_organization_role_teams_test.go +++ b/github/data_source_github_organization_role_teams_test.go @@ -10,7 +10,7 @@ import ( func TestAccDataSourceGithubOrganizationRoleTeams(t *testing.T) { t.Run("get the organization role teams without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) roleId := 8134 config := fmt.Sprintf(` @@ -51,7 +51,7 @@ func TestAccDataSourceGithubOrganizationRoleTeams(t *testing.T) { }) t.Run("get indirect organization role teams without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName1 := fmt.Sprintf("%steam-1-%s", testResourcePrefix, randomID) teamName2 := fmt.Sprintf("%steam-2-%s", testResourcePrefix, randomID) roleId := 8134 diff --git a/github/data_source_github_organization_role_users_test.go b/github/data_source_github_organization_role_users_test.go index 4a831b245e..65319382df 100644 --- a/github/data_source_github_organization_role_users_test.go +++ b/github/data_source_github_organization_role_users_test.go @@ -52,7 +52,7 @@ func TestAccDataSourceGithubOrganizationRoleUsers(t *testing.T) { t.Skip("Skipping test because no organization user has been configured") } - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) roleId := 8134 config := fmt.Sprintf(` diff --git a/github/data_source_github_organization_security_managers.go b/github/data_source_github_organization_security_managers.go index 48dc8fcf32..f120cc1369 100644 --- a/github/data_source_github_organization_security_managers.go +++ b/github/data_source_github_organization_security_managers.go @@ -9,14 +9,16 @@ import ( func dataSourceGithubOrganizationSecurityManagers() *schema.Resource { return &schema.Resource{ + Description: "Use this data source to retrieve the teams with the security manager role in an organization.", DeprecationMessage: "This data source is deprecated in favour of using the github_organization_role_teams data source.", Read: dataSourceGithubOrganizationSecurityManagersRead, Schema: map[string]*schema.Schema{ "teams": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "An array of teams with the security manager role.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { diff --git a/github/data_source_github_organization_security_managers_test.go b/github/data_source_github_organization_security_managers_test.go index 271a31dded..7a101161c5 100644 --- a/github/data_source_github_organization_security_managers_test.go +++ b/github/data_source_github_organization_security_managers_test.go @@ -10,7 +10,7 @@ import ( func TestAccDataSourceGithubOrganizationSecurityManagers(t *testing.T) { t.Run("get the organization security managers without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_organization_team_sync_groups.go b/github/data_source_github_organization_team_sync_groups.go index 416bd655f5..0da2fb81a5 100644 --- a/github/data_source_github_organization_team_sync_groups.go +++ b/github/data_source_github_organization_team_sync_groups.go @@ -10,25 +10,30 @@ import ( func dataSourceGithubOrganizationTeamSyncGroups() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubOrganizationTeamSyncGroupsRead, + Description: "Use this data source to retrieve the identity provider groups for team synchronization in an organization.", + Read: dataSourceGithubOrganizationTeamSyncGroupsRead, Schema: map[string]*schema.Schema{ "groups": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "An array of GitHub Identity Provider Groups.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "group_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The ID of the IdP group.", }, "group_name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the IdP group.", }, "group_description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The description of the IdP group.", }, }, }, diff --git a/github/data_source_github_organization_teams.go b/github/data_source_github_organization_teams.go index 3fc86ffc42..45ecc86ad9 100644 --- a/github/data_source_github_organization_teams.go +++ b/github/data_source_github_organization_teams.go @@ -12,77 +12,93 @@ import ( func dataSourceGithubOrganizationTeams() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubOrganizationTeamsRead, + Description: "Use this data source to retrieve the teams in an organization.", + Read: dataSourceGithubOrganizationTeamsRead, Schema: map[string]*schema.Schema{ "root_teams_only": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Only return teams that are at the organization's root, i.e. no nested teams.", }, "summary_only": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Exclude the members and repositories of the team from the returned result.", }, "results_per_page": { Type: schema.TypeInt, Optional: true, Default: 100, ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 100), "results_per_page"), + Description: "Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100.", }, "teams": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "An array of GitHub teams.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the team.", }, "node_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Node ID of the team.", }, "slug": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The slug of the team.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The team's full name.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The team's description.", }, "privacy": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The team's privacy type.", }, "members": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "List of team members. Not returned if summary_only is true.", }, "repositories": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "List of team repositories. Not returned if summary_only is true.", }, "parent": { - Deprecated: "Use parent_team_id and parent_team_slug instead.", - Type: schema.TypeMap, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Deprecated: "Use parent_team_id and parent_team_slug instead.", + Type: schema.TypeMap, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "The parent team.", }, "parent_team_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The ID of the parent team, if there is one.", }, "parent_team_slug": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The slug of the parent team, if there is one.", }, }, }, diff --git a/github/data_source_github_organization_teams_test.go b/github/data_source_github_organization_teams_test.go index ebd1a0fe67..9d5bec2cb8 100644 --- a/github/data_source_github_organization_teams_test.go +++ b/github/data_source_github_organization_teams_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubOrganizationTeamsDataSource(t *testing.T) { t.Run("queries", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-0-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_organization_test.go b/github/data_source_github_organization_test.go index 474c78b7f4..170b5b5639 100644 --- a/github/data_source_github_organization_test.go +++ b/github/data_source_github_organization_test.go @@ -56,7 +56,7 @@ func TestAccGithubOrganizationDataSource(t *testing.T) { }) t.Run("queries for an organization with archived repos", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-archived-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_organization_webhooks.go b/github/data_source_github_organization_webhooks.go index b808398b8e..fd4dcb1924 100644 --- a/github/data_source_github_organization_webhooks.go +++ b/github/data_source_github_organization_webhooks.go @@ -9,33 +9,40 @@ import ( func dataSourceGithubOrganizationWebhooks() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubOrganizationWebhooksRead, + Description: "Use this data source to retrieve the webhooks for an organization.", + Read: dataSourceGithubOrganizationWebhooksRead, Schema: map[string]*schema.Schema{ "webhooks": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "An array of GitHub webhooks.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the webhook.", }, "type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The type of the webhook.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the webhook.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL of the webhook.", }, "active": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the webhook is active.", }, }, }, diff --git a/github/data_source_github_ref.go b/github/data_source_github_ref.go index c68c7e688d..07deae694d 100644 --- a/github/data_source_github_ref.go +++ b/github/data_source_github_ref.go @@ -12,30 +12,34 @@ import ( func dataSourceGithubRef() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubRefRead, + Description: "Use this data source to retrieve information about a repository ref (branch or tag).", + Read: dataSourceGithubRefRead, Schema: map[string]*schema.Schema{ "ref": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + Description: "The repository ref to look up. Must be formatted 'heads/' for branches, and 'tags/' for tags.", }, "repository": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + Description: "The GitHub repository name.", }, "owner": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "Owner of the repository.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the ref.", }, "sha": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The reference's HEAD commit's SHA1.", }, }, } @@ -69,7 +73,7 @@ func dataSourceGithubRefRead(d *schema.ResourceData, meta any) error { if err != nil { return err } - err = d.Set("sha", *refData.Object.SHA) + err = d.Set("sha", refData.Object.SHA) if err != nil { return err } diff --git a/github/data_source_github_ref_test.go b/github/data_source_github_ref_test.go index 2e117cb510..aa769142c0 100644 --- a/github/data_source_github_ref_test.go +++ b/github/data_source_github_ref_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRefDataSource(t *testing.T) { t.Run("queries an existing branch ref without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ref-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -42,7 +42,7 @@ func TestAccGithubRefDataSource(t *testing.T) { // Can't test due to SDK and test framework limitations // t.Run("queries an invalid ref without error", func(t *testing.T) { - // randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + // randomID := acctest.RandString(5) // repoName := fmt.Sprintf("%srepo-invalid-ref-%s", testResourcePrefix, randomID) // config := fmt.Sprintf(` // resource "github_repository" "test" { diff --git a/github/data_source_github_release.go b/github/data_source_github_release.go index 092e33a4d2..641742b0a9 100644 --- a/github/data_source_github_release.go +++ b/github/data_source_github_release.go @@ -48,106 +48,131 @@ func dataSourceGithubRelease() *schema.Resource { Description: "ID of the release to retrieve. Must be specified when `retrieve_by` = `id`.", }, "target_commitish": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Commitish value that determines where the Git release is created from.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Name of the release.", }, "body": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Contents of the description (body) of a release.", }, "draft": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the release is a draft.", }, "prerelease": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the release is a prerelease.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Date of release creation.", }, "published_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Date of release publishing.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Base URL of the release.", }, "html_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL directing to detailed information on the release.", }, "assets_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL of any associated assets with the release.", }, "asserts_url": { - Type: schema.TypeString, - Computed: true, - Deprecated: "use assets_url instead", + Type: schema.TypeString, + Computed: true, + Deprecated: "use assets_url instead", + Description: "URL of any associated assets with the release.", }, "upload_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL that can be used to upload assets to the release.", }, "zipball_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Download URL of the release in zip format.", }, "tarball_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Download URL of the release in tar.gz format.", }, "assets": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "Collection of assets for the release.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "ID of the asset.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL of the asset.", }, "node_id": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Node ID of the asset.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The file name of the asset.", }, "label": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Label for the asset.", }, "content_type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "MIME type of the asset.", }, "size": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Size of the asset in bytes.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Date the asset was created.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Date the asset was last updated.", }, "browser_download_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Browser download URL.", }, }, }, diff --git a/github/data_source_github_repositories.go b/github/data_source_github_repositories.go index abfbf7fc63..be9c8330bf 100644 --- a/github/data_source_github_repositories.go +++ b/github/data_source_github_repositories.go @@ -10,46 +10,54 @@ import ( func dataSourceGithubRepositories() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubRepositoriesRead, + Description: "Use this data source to search for GitHub repositories.", + Read: dataSourceGithubRepositoriesRead, Schema: map[string]*schema.Schema{ "query": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Search query. See documentation for the search syntax.", }, "sort": { Type: schema.TypeString, Default: "updated", Optional: true, ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"stars", "fork", "updated"}, false), "sort"), + Description: "Sorts the repositories returned by the specified attribute. Valid values include 'stars', 'fork', and 'updated'.", }, "include_repo_id": { - Type: schema.TypeBool, - Default: false, - Optional: true, + Type: schema.TypeBool, + Default: false, + Optional: true, + Description: "Returns a list of found repository IDs.", }, "results_per_page": { Type: schema.TypeInt, Optional: true, Default: 100, ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 1000), "results_per_page"), + Description: "Set the number of repositories requested per API call.", }, "full_names": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "A list of full names of found repositories (e.g. 'hashicorp/terraform').", Elem: &schema.Schema{ Type: schema.TypeString, }, Computed: true, }, "names": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "A list of found repository names (e.g. 'terraform').", Elem: &schema.Schema{ Type: schema.TypeString, }, Computed: true, }, "repo_ids": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "A list of found repository IDs.", Elem: &schema.Schema{ Type: schema.TypeInt, }, diff --git a/github/data_source_github_repository.go b/github/data_source_github_repository.go index 56972f89d5..2c0c5823d3 100644 --- a/github/data_source_github_repository.go +++ b/github/data_source_github_repository.go @@ -23,323 +23,396 @@ func dataSourceGithubRepository() *schema.Resource { Optional: true, Computed: true, ConflictsWith: []string{"name"}, + Description: "Full name of the repository (in org/name format).", }, "name": { Type: schema.TypeString, Optional: true, Computed: true, ConflictsWith: []string{"full_name"}, + Description: "The name of the repository.", }, "description": { - Type: schema.TypeString, - Default: nil, - Optional: true, + Type: schema.TypeString, + Default: nil, + Optional: true, + Description: "A description of the repository.", }, "homepage_url": { - Type: schema.TypeString, - Default: "", - Optional: true, + Type: schema.TypeString, + Default: "", + Optional: true, + Description: "URL of a page describing the project.", }, "private": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository is private.", }, "visibility": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Whether the repository is public, private or internal.", }, "has_issues": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository has GitHub Issues enabled.", }, "has_discussions": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository has GitHub Discussions enabled.", }, "has_projects": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository has the GitHub Projects enabled.", }, "has_downloads": { - Type: schema.TypeBool, - Computed: true, - Deprecated: "This attribute is no longer in use, but it hasn't been removed yet. It will be removed in a future version. See https://github.com/orgs/community/discussions/102145#discussioncomment-8351756", + Type: schema.TypeBool, + Computed: true, + Deprecated: "This attribute is no longer in use, but it hasn't been removed yet. It will be removed in a future version. See https://github.com/orgs/community/discussions/102145#discussioncomment-8351756", + Description: "Whether the repository has Downloads feature enabled.", }, "has_wiki": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository has the GitHub Wiki enabled.", }, "is_template": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository is a template repository.", }, "fork": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository is a fork.", }, "allow_merge_commit": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository allows merge commits.", }, "allow_squash_merge": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository allows squash merges.", }, "allow_rebase_merge": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository allows rebase merges.", }, "allow_auto_merge": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository allows auto-merging pull requests.", }, "allow_update_branch": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository allows updating pull request branches.", }, "allow_forking": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository allows private forking.", }, "squash_merge_commit_title": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The default value for a squash merge commit title.", }, "squash_merge_commit_message": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The default value for a squash merge commit message.", }, "merge_commit_title": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The default value for a merge commit title.", }, "merge_commit_message": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The default value for a merge commit message.", }, "default_branch": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the default branch of the repository.", }, "primary_language": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The primary language used in the repository.", }, "archived": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the repository is archived.", }, "repository_license": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "An array of GitHub repository licenses.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the license file (e.g., 'LICENSE').", }, "path": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The path to the license file within the repository.", }, "license": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The license details.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A key representing the license type (e.g., 'apache-2.0').", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the license (e.g., 'Apache License 2.0').", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL to access information about the license on GitHub.", }, "spdx_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The SPDX identifier for the license (e.g., 'Apache-2.0').", }, "html_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL to view the license details on GitHub.", }, "featured": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Indicates if the license is featured.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A description of the license.", }, "implementation": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Details about the implementation of the license.", }, "permissions": { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Permissions associated with the license.", }, "conditions": { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Conditions associated with the license.", }, "limitations": { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Limitations associated with the license.", }, "body": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The text of the license.", }, }, }, }, "sha": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The SHA hash of the license file.", }, "size": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The size of the license file in bytes.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL to access information about the license file on GitHub.", }, "html_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL to view the license file on GitHub.", }, "git_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL to access information about the license file as a Git blob.", }, "download_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL to download the raw content of the license file.", }, "type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The type of the content (e.g., 'file').", }, "content": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Content of the license file, encoded by encoding scheme mentioned below.", }, "encoding": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The encoding used for the content (e.g., 'base64').", }, }, }, }, "pages": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The repository's GitHub Pages configuration.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "source": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The source configuration for GitHub Pages.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "branch": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The branch used for GitHub Pages.", }, "path": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The path within the branch used for GitHub Pages.", }, }, }, }, "build_type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The type of build for GitHub Pages.", }, "cname": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The custom domain for the GitHub Pages site.", }, "custom_404": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the GitHub Pages site has a custom 404 page.", }, "html_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL for the GitHub Pages site.", }, "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The status of the GitHub Pages site.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The API URL for the GitHub Pages configuration.", }, }, }, }, "topics": { - Type: schema.TypeList, - Elem: &schema.Schema{Type: schema.TypeString}, - Computed: true, + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + Description: "The list of topics of the repository.", }, "html_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL to the repository on the web.", }, "ssh_clone_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL that can be provided to git clone to clone the repository via SSH.", }, "svn_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL that can be provided to svn checkout to check out the repository via GitHub's Subversion protocol emulation.", }, "git_clone_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL that can be provided to git clone to clone the repository anonymously via the git protocol.", }, "http_clone_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL that can be provided to git clone to clone the repository via HTTPS.", }, "template": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The repository source template configuration.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "owner": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The owner of the template repository.", }, "repository": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the template repository.", }, }, }, }, "node_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "GraphQL global node ID for use with v4 API.", }, "repo_id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "GitHub ID for the repository.", }, "delete_branch_on_merge": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether head branches are automatically deleted on pull request merges.", }, }, } diff --git a/github/data_source_github_repository_autolink_references.go b/github/data_source_github_repository_autolink_references.go index ab888bcf3a..b41c9f05bf 100644 --- a/github/data_source_github_repository_autolink_references.go +++ b/github/data_source_github_repository_autolink_references.go @@ -9,29 +9,35 @@ import ( func dataSourceGithubRepositoryAutolinkReferences() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubRepositoryAutolinkReferencesRead, + Description: "Use this data source to retrieve the autolink references for a repository.", + Read: dataSourceGithubRepositoryAutolinkReferencesRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Name of the repository to retrieve the autolink references from.", }, "autolink_references": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The list of this repository's autolink references.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key_prefix": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Key prefix.", }, "target_url_template": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Target URL template.", }, "is_alphanumeric": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether this autolink reference matches alphanumeric characters.", }, }, }, diff --git a/github/data_source_github_repository_autolink_references_test.go b/github/data_source_github_repository_autolink_references_test.go index 8039f4ef39..7159e16d84 100644 --- a/github/data_source_github_repository_autolink_references_test.go +++ b/github/data_source_github_repository_autolink_references_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccGithubRepositoryAutolinkReferencesDataSource(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-autolink-refs-%s", testResourcePrefix, randomID) t.Run("queries autolink references", func(t *testing.T) { diff --git a/github/data_source_github_repository_branches.go b/github/data_source_github_repository_branches.go index ff9ddd2fc1..dc1880cae9 100644 --- a/github/data_source_github_repository_branches.go +++ b/github/data_source_github_repository_branches.go @@ -10,36 +10,43 @@ import ( func dataSourceGithubRepositoryBranches() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubRepositoryBranchesRead, + Description: "Use this data source to retrieve the branches for a repository.", + Read: dataSourceGithubRepositoryBranchesRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Name of the repository to retrieve the branches from.", }, "only_protected_branches": { Type: schema.TypeBool, Optional: true, Default: false, ConflictsWith: []string{"only_non_protected_branches"}, + Description: "If true, the branches attributes will be populated only with protected branches.", }, "only_non_protected_branches": { Type: schema.TypeBool, Optional: true, Default: false, ConflictsWith: []string{"only_protected_branches"}, + Description: "If true, the branches attributes will be populated only with non protected branches.", }, "branches": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The list of this repository's branches.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Name of the branch.", }, "protected": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the branch is protected.", }, }, }, diff --git a/github/data_source_github_repository_custom_properties.go b/github/data_source_github_repository_custom_properties.go index a2001db80a..31f12d0796 100644 --- a/github/data_source_github_repository_custom_properties.go +++ b/github/data_source_github_repository_custom_properties.go @@ -10,7 +10,8 @@ import ( func dataSourceGithubRepositoryCustomProperties() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubOrgaRepositoryCustomProperties, + Description: "Use this data source to retrieve the custom properties for a repository.", + Read: dataSourceGithubOrgaRepositoryCustomProperties, Schema: map[string]*schema.Schema{ "repository": { diff --git a/github/data_source_github_repository_custom_properties_test.go b/github/data_source_github_repository_custom_properties_test.go index de2f82acc3..2811e8cbf7 100644 --- a/github/data_source_github_repository_custom_properties_test.go +++ b/github/data_source_github_repository_custom_properties_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryCustomPropertiesDataSource(t *testing.T) { t.Run("creates custom property of type single_select without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) propertyName := fmt.Sprintf("tf-acc-test-property-%s", randomID) repoName := fmt.Sprintf("%srepo-custom-props-%s", testResourcePrefix, randomID) @@ -57,7 +57,7 @@ func TestAccGithubRepositoryCustomPropertiesDataSource(t *testing.T) { }) t.Run("creates custom property of type multi_select without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) propertyName := fmt.Sprintf("tf-acc-test-property-%s", randomID) repoName := fmt.Sprintf("%srepo-custom-props-%s", testResourcePrefix, randomID) @@ -105,7 +105,7 @@ func TestAccGithubRepositoryCustomPropertiesDataSource(t *testing.T) { }) t.Run("creates custom property of type true_false without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) propertyName := fmt.Sprintf("tf-acc-test-property-%s", randomID) repoName := fmt.Sprintf("%srepo-custom-props-%s", testResourcePrefix, randomID) @@ -151,7 +151,7 @@ func TestAccGithubRepositoryCustomPropertiesDataSource(t *testing.T) { }) t.Run("creates custom property of type string without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) propertyName := fmt.Sprintf("tf-acc-test-property-%s", randomID) repoName := fmt.Sprintf("%srepo-custom-props-%s", testResourcePrefix, randomID) diff --git a/github/data_source_github_repository_deploy_keys.go b/github/data_source_github_repository_deploy_keys.go index e83a5f6a7b..6b11cc631c 100644 --- a/github/data_source_github_repository_deploy_keys.go +++ b/github/data_source_github_repository_deploy_keys.go @@ -10,33 +10,40 @@ import ( func dataSourceGithubRepositoryDeployKeys() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubRepositoryDeployKeysRead, + Description: "Use this data source to retrieve the deploy keys for a repository.", + Read: dataSourceGithubRepositoryDeployKeysRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Name of the repository to retrieve the deploy keys from.", }, "keys": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The list of this repository's deploy keys.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Key ID.", }, "key": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Key itself.", }, "title": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Key title.", }, "verified": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the key was verified.", }, }, }, diff --git a/github/data_source_github_repository_deploy_keys_test.go b/github/data_source_github_repository_deploy_keys_test.go index 28e2d266cc..62168f02e4 100644 --- a/github/data_source_github_repository_deploy_keys_test.go +++ b/github/data_source_github_repository_deploy_keys_test.go @@ -13,7 +13,7 @@ import ( func TestAccGithubRepositoryDeployKeysDataSource(t *testing.T) { t.Run("manages deploy keys", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) keyName := fmt.Sprintf("%s_rsa", randomID) cmd := exec.Command("bash", "-c", fmt.Sprintf("ssh-keygen -t rsa -b 4096 -C test@example.com -N '' -f test-fixtures/%s>/dev/null <<< y >/dev/null", keyName)) if err := cmd.Run(); err != nil { diff --git a/github/data_source_github_repository_deployment_branch_policies.go b/github/data_source_github_repository_deployment_branch_policies.go index 5091257efb..bd0b4d39ef 100644 --- a/github/data_source_github_repository_deployment_branch_policies.go +++ b/github/data_source_github_repository_deployment_branch_policies.go @@ -9,6 +9,7 @@ import ( func dataSourceGithubRepositoryDeploymentBranchPolicies() *schema.Resource { return &schema.Resource{ + Description: "Use this data source to retrieve the deployment branch policies for a repository environment.", DeprecationMessage: "This data source is deprecated in favour of the github_repository_environment_deployment_policies data source.", Read: dataSourceGithubRepositoryDeploymentBranchPoliciesRead, @@ -17,27 +18,28 @@ func dataSourceGithubRepositoryDeploymentBranchPolicies() *schema.Resource { "repository": { Type: schema.TypeString, Required: true, - ForceNew: true, Description: "The GitHub repository name.", }, "environment_name": { Type: schema.TypeString, Required: true, - ForceNew: true, Description: "The target environment name.", }, "deployment_branch_policies": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The list of this repository/environment deployment policies.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "ID of the policy.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name pattern that branches must match in order to deploy to the environment.", }, }, }, diff --git a/github/data_source_github_repository_deployment_branch_policies_test.go b/github/data_source_github_repository_deployment_branch_policies_test.go index 8ee470b88c..ab735632e1 100644 --- a/github/data_source_github_repository_deployment_branch_policies_test.go +++ b/github/data_source_github_repository_deployment_branch_policies_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryDeploymentBranchPolicies(t *testing.T) { t.Run("queries deployment branch policies", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-deploy-bp-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/data_source_github_repository_environment_deployment_policies.go b/github/data_source_github_repository_environment_deployment_policies.go index ca801d97fc..29601724e8 100644 --- a/github/data_source_github_repository_environment_deployment_policies.go +++ b/github/data_source_github_repository_environment_deployment_policies.go @@ -26,17 +26,20 @@ func dataSourceGithubRepositoryEnvironmentDeploymentPolicies() *schema.Resource Description: "The name of the environment.", }, "policies": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "An array of deployment branch policies.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The type of deployment policy (branch or tag).", }, "pattern": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name pattern that branches or tags must match in order to deploy to the environment.", }, }, }, diff --git a/github/data_source_github_repository_environment_deployment_policies_test.go b/github/data_source_github_repository_environment_deployment_policies_test.go index efb91a1951..9db56364e9 100644 --- a/github/data_source_github_repository_environment_deployment_policies_test.go +++ b/github/data_source_github_repository_environment_deployment_policies_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryEnvironmentDeploymentPolicies(t *testing.T) { t.Run("queries environment deployment policies", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-deploy-pol-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_repository_environments.go b/github/data_source_github_repository_environments.go index 926a57a54e..63749f26f7 100644 --- a/github/data_source_github_repository_environments.go +++ b/github/data_source_github_repository_environments.go @@ -14,21 +14,25 @@ func dataSourceGithubRepositoryEnvironments() *schema.Resource { Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Name of the repository to retrieve the environments from.", }, "environments": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The list of this repository's environments.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Environment name.", }, "node_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Environment node ID.", }, }, }, diff --git a/github/data_source_github_repository_environments_test.go b/github/data_source_github_repository_environments_test.go index 0e819b3c09..b83e685427 100644 --- a/github/data_source_github_repository_environments_test.go +++ b/github/data_source_github_repository_environments_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccGithubRepositoryEnvironmentsDataSource(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-envs-%s", testResourcePrefix, randomID) t.Run("queries environments", func(t *testing.T) { diff --git a/github/data_source_github_repository_file_test.go b/github/data_source_github_repository_file_test.go index abb53ab289..0624ba8b41 100644 --- a/github/data_source_github_repository_file_test.go +++ b/github/data_source_github_repository_file_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryFileDataSource(t *testing.T) { t.Run("reads a file with a branch name provided without erroring", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-file-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -61,7 +61,7 @@ func TestAccGithubRepositoryFileDataSource(t *testing.T) { }) t.Run("reads a file from a short repo name without erroring", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-file-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -114,7 +114,7 @@ func TestAccGithubRepositoryFileDataSource(t *testing.T) { }) t.Run("create and read a file without providing a branch name", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-file-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -167,7 +167,7 @@ func TestAccGithubRepositoryFileDataSource(t *testing.T) { // Can't test due to SDK and test framework limitations // t.Run("try reading a non-existent file without an error", func(t *testing.T) { - // randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + // randomID := acctest.RandString(5) // config := fmt.Sprintf(` // resource "github_repository" "test" { // name = "tf-acc-test-%s" @@ -207,7 +207,7 @@ func TestAccGithubRepositoryFileDataSource(t *testing.T) { // }) t.Run("reads a directory without erroring", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-file-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/data_source_github_repository_milestone.go b/github/data_source_github_repository_milestone.go index ee4b28d564..f6a741866e 100644 --- a/github/data_source_github_repository_milestone.go +++ b/github/data_source_github_repository_milestone.go @@ -9,36 +9,44 @@ import ( func dataSourceGithubRepositoryMilestone() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubRepositoryMilestoneRead, + Description: "Use this data source to retrieve information about a milestone in a repository.", + Read: dataSourceGithubRepositoryMilestoneRead, Schema: map[string]*schema.Schema{ "owner": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Owner of the repository.", }, "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Name of the repository to retrieve the milestone from.", }, "number": { - Type: schema.TypeInt, - Required: true, + Type: schema.TypeInt, + Required: true, + Description: "The number of the milestone.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Description of the milestone.", }, "due_date": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The milestone due date (in ISO-8601 yyyy-mm-dd format).", }, "state": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "State of the milestone.", }, "title": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Title of the milestone.", }, }, } diff --git a/github/data_source_github_repository_milestone_test.go b/github/data_source_github_repository_milestone_test.go index bb0018f3ea..ba71153aaf 100644 --- a/github/data_source_github_repository_milestone_test.go +++ b/github/data_source_github_repository_milestone_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubRepositoryMilestoneDataSource(t *testing.T) { t.Run("queries a repository milestone", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-milestone-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_repository_pull_request.go b/github/data_source_github_repository_pull_request.go index a878c05f14..7e5422016e 100644 --- a/github/data_source_github_repository_pull_request.go +++ b/github/data_source_github_repository_pull_request.go @@ -9,82 +9,99 @@ import ( func dataSourceGithubRepositoryPullRequest() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubRepositoryPullRequestRead, + Description: "Use this data source to retrieve information about a pull request in a repository.", + Read: dataSourceGithubRepositoryPullRequestRead, Schema: map[string]*schema.Schema{ "owner": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "Owner of the repository. If not provided, the provider's default owner is used.", }, "base_repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Name of the base repository to retrieve the Pull Request from.", }, "number": { - Type: schema.TypeInt, - Required: true, + Type: schema.TypeInt, + Required: true, + Description: "The number of the Pull Request within the repository.", }, "base_ref": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Name of the ref (branch) of the Pull Request base.", }, "base_sha": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Head commit SHA of the Pull Request base.", }, "body": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Body of the Pull Request.", }, "draft": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether this Pull Request is a draft.", }, "head_owner": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Owner of the Pull Request head repository.", }, "head_ref": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Value of the Pull Request HEAD reference.", }, "head_repository": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Name of the Pull Request head repository.", }, "head_sha": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Head commit SHA of the Pull Request head.", }, "labels": { Type: schema.TypeList, Elem: &schema.Schema{Type: schema.TypeString}, Computed: true, - Description: "List of names of labels on the PR", + Description: "List of label names set on the Pull Request.", }, "maintainer_can_modify": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether the base repository maintainers can modify the Pull Request.", }, "opened_at": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Unix timestamp indicating the Pull Request creation time.", }, "opened_by": { Type: schema.TypeString, Computed: true, - Description: "Username of the PR creator", + Description: "GitHub login of the user who opened the Pull Request.", }, "state": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The current Pull Request state - can be 'open', 'closed' or 'merged'.", }, "title": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The title of the Pull Request.", }, "updated_at": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The timestamp of the last Pull Request update.", }, }, } diff --git a/github/data_source_github_repository_pull_request_test.go b/github/data_source_github_repository_pull_request_test.go index d3818cfa2a..7ec80be885 100644 --- a/github/data_source_github_repository_pull_request_test.go +++ b/github/data_source_github_repository_pull_request_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryPullRequestDataSource(t *testing.T) { t.Run("manages the pull request lifecycle", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-pr-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_repository_pull_requests.go b/github/data_source_github_repository_pull_requests.go index f330461364..578bfb3ff9 100644 --- a/github/data_source_github_repository_pull_requests.go +++ b/github/data_source_github_repository_pull_requests.go @@ -12,114 +12,136 @@ import ( // Docs: https://docs.github.com/en/rest/reference/pulls#list-pull-requests func dataSourceGithubRepositoryPullRequests() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubRepositoryPullRequestsRead, + Description: "Use this data source to retrieve the list of pull requests in a repository.", + Read: dataSourceGithubRepositoryPullRequestsRead, Schema: map[string]*schema.Schema{ "owner": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "Owner of the repository. If not provided, the provider's default owner is used.", }, "base_repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "Name of the base repository to retrieve the Pull Requests from.", }, "base_ref": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "If set, filters Pull Requests by base branch name.", }, "head_ref": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "If set, filters Pull Requests by head user or head organization and branch name.", }, "sort_by": { Type: schema.TypeString, Optional: true, Default: "created", ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"created", "updated", "popularity", "long-running"}, false), "sort_by"), + Description: "Indicates what to sort results by. Can be 'created', 'updated', 'popularity', or 'long-running'.", }, "sort_direction": { Type: schema.TypeString, Optional: true, Default: "asc", ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"asc", "desc"}, false), "sort_direction"), + Description: "The direction of the sort. Can be 'asc' or 'desc'.", }, "state": { Type: schema.TypeString, Default: "open", Optional: true, ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"open", "closed", "all"}, false), "state"), + Description: "Filters Pull Requests by state. Can be 'open', 'closed', or 'all'.", }, "results": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "Collection of Pull Requests matching the filters.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "number": { Type: schema.TypeInt, Computed: true, - Description: "Per-repository, monotonically increasing ID of this PR", + Description: "The number of the Pull Request within the repository.", }, "base_ref": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Name of the ref (branch) of the Pull Request base.", }, "base_sha": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Head commit SHA of the Pull Request base.", }, "body": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Body of the Pull Request.", }, "draft": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether this Pull Request is a draft.", }, "head_owner": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Owner of the Pull Request head repository.", }, "head_ref": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Value of the Pull Request HEAD reference.", }, "head_repository": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Name of the Pull Request head repository.", }, "head_sha": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Head commit SHA of the Pull Request head.", }, "labels": { Type: schema.TypeList, Elem: &schema.Schema{Type: schema.TypeString}, Computed: true, - Description: "List of names of labels on the PR", + Description: "List of label names set on the Pull Request.", }, "maintainer_can_modify": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Indicates whether the base repository maintainers can modify the Pull Request.", }, "opened_at": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "Unix timestamp indicating the Pull Request creation time.", }, "opened_by": { Type: schema.TypeString, Computed: true, - Description: "Username of the PR creator", + Description: "GitHub login of the user who opened the Pull Request.", }, "state": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The current Pull Request state - can be 'open', 'closed' or 'merged'.", }, "title": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The title of the Pull Request.", }, "updated_at": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The timestamp of the last Pull Request update.", }, }, }, diff --git a/github/data_source_github_repository_pull_requests_test.go b/github/data_source_github_repository_pull_requests_test.go index 4579382470..483efaeee0 100644 --- a/github/data_source_github_repository_pull_requests_test.go +++ b/github/data_source_github_repository_pull_requests_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryPullRequestsDataSource(t *testing.T) { t.Run("manages the pull request lifecycle", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-prs-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_repository_teams.go b/github/data_source_github_repository_teams.go index 94d7d0c374..0786b68113 100644 --- a/github/data_source_github_repository_teams.go +++ b/github/data_source_github_repository_teams.go @@ -11,7 +11,8 @@ import ( func dataSourceGithubRepositoryTeams() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubTeamsRead, + Description: "Use this data source to retrieve the teams associated with a repository.", + Read: dataSourceGithubTeamsRead, Schema: map[string]*schema.Schema{ "full_name": { @@ -19,29 +20,35 @@ func dataSourceGithubRepositoryTeams() *schema.Resource { Optional: true, Computed: true, ConflictsWith: []string{"name"}, + Description: "Full name of the repository (in org/name format).", }, "name": { Type: schema.TypeString, Optional: true, Computed: true, ConflictsWith: []string{"full_name"}, + Description: "The name of the repository.", }, "teams": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of teams which have access to the repository.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Team name.", }, "slug": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Team slug.", }, "permission": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Team permission.", }, }, }, diff --git a/github/data_source_github_repository_teams_test.go b/github/data_source_github_repository_teams_test.go index a4f1cb123e..2bbefeb2d6 100644 --- a/github/data_source_github_repository_teams_test.go +++ b/github/data_source_github_repository_teams_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryTeamsDataSource(t *testing.T) { t.Run("queries teams of an existing repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) repoName := fmt.Sprintf("%srepo-%s", testResourcePrefix, randomID) diff --git a/github/data_source_github_repository_test.go b/github/data_source_github_repository_test.go index 515c639aab..3bd9cadc62 100644 --- a/github/data_source_github_repository_test.go +++ b/github/data_source_github_repository_test.go @@ -85,7 +85,7 @@ func TestAccDataSourceGithubRepository(t *testing.T) { }) t.Run("queries a repository with pages configured", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ds-pages-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -124,7 +124,7 @@ func TestAccDataSourceGithubRepository(t *testing.T) { }) t.Run("checks defaults on a new repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ds-defaults-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -217,7 +217,7 @@ func TestAccDataSourceGithubRepository(t *testing.T) { }) t.Run("queries a repository that was generated from a template", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ds-template-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -258,7 +258,7 @@ func TestAccDataSourceGithubRepository(t *testing.T) { }) t.Run("queries a repository that has no primary_language", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ds-nolang-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -291,7 +291,7 @@ func TestAccDataSourceGithubRepository(t *testing.T) { }) // t.Run("queries a repository that has go as primary_language", func(t *testing.T) { - // randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + // randomID := acctest.RandString(5) // testResourceName := fmt.Sprintf("%srepo-%s", testResourcePrefix, randomID) // config := fmt.Sprintf(` @@ -333,7 +333,7 @@ func TestAccDataSourceGithubRepository(t *testing.T) { // }) t.Run("queries a repository that has a license", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ds-license-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_repository_webhooks.go b/github/data_source_github_repository_webhooks.go index 546473f782..86f5ad0766 100644 --- a/github/data_source_github_repository_webhooks.go +++ b/github/data_source_github_repository_webhooks.go @@ -10,37 +10,45 @@ import ( func dataSourceGithubRepositoryWebhooks() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubRepositoryWebhooksRead, + Description: "Use this data source to retrieve the webhooks for a repository.", + Read: dataSourceGithubRepositoryWebhooksRead, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the repository.", }, "webhooks": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "An array of GitHub webhooks.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the webhook.", }, "type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The type of the webhook.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the webhook.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL of the webhook.", }, "active": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the webhook is active.", }, }, }, diff --git a/github/data_source_github_rest_api.go b/github/data_source_github_rest_api.go index a0dfe28785..12f6935ea5 100644 --- a/github/data_source_github_rest_api.go +++ b/github/data_source_github_rest_api.go @@ -10,29 +10,34 @@ import ( func dataSourceGithubRestApi() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubRestApiRead, + Description: "Use this data source to perform a GET request to the GitHub REST API.", + Read: dataSourceGithubRestApiRead, Schema: map[string]*schema.Schema{ "endpoint": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + Description: "REST API endpoint to send the GET request to.", }, "code": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "A response status code.", }, "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A response status string.", }, "headers": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A JSON string containing response headers.", }, "body": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "A JSON string containing response body.", }, }, } diff --git a/github/data_source_github_rest_api_test.go b/github/data_source_github_rest_api_test.go index d1024cb6ad..27b31d621f 100644 --- a/github/data_source_github_rest_api_test.go +++ b/github/data_source_github_rest_api_test.go @@ -10,7 +10,7 @@ import ( ) func TestAccGithubRestApiDataSource(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-rest-api-%s", testResourcePrefix, randomID) t.Run("queries an existing branch without error", func(t *testing.T) { diff --git a/github/data_source_github_ssh_keys.go b/github/data_source_github_ssh_keys.go index 3d4a58e75d..0536460f42 100644 --- a/github/data_source_github_ssh_keys.go +++ b/github/data_source_github_ssh_keys.go @@ -4,13 +4,15 @@ import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" func dataSourceGithubSshKeys() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubSshKeysRead, + Description: "Use this data source to retrieve GitHub's SSH public keys.", + Read: dataSourceGithubSshKeysRead, Schema: map[string]*schema.Schema{ "keys": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "An array of GitHub's SSH public keys.", }, }, } diff --git a/github/data_source_github_team.go b/github/data_source_github_team.go index 7472867c59..5432182e67 100644 --- a/github/data_source_github_team.go +++ b/github/data_source_github_team.go @@ -19,75 +19,90 @@ func dataSourceGithubTeam() *schema.Resource { Schema: map[string]*schema.Schema{ "slug": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The team slug.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The team's full name.", }, "description": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The team's description.", }, "privacy": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The team's privacy type (closed or secret).", }, "notification_setting": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The team's notification setting (notifications_enabled or notifications_disabled).", }, "permission": { - Type: schema.TypeString, - Computed: true, - Deprecated: "Closing down notice.", + Type: schema.TypeString, + Computed: true, + Deprecated: "Closing down notice.", + Description: "The permission that new repositories will be added to the team with.", }, "members": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "List of team members (GitHub usernames). Not returned if summary_only is true.", }, "repositories": { - Deprecated: "Use repositories_detailed instead.", - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Deprecated: "Use repositories_detailed instead.", + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "List of team repositories (repo names). Not returned if summary_only is true.", }, "repositories_detailed": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "List of team repositories with detailed information. Not returned if summary_only is true.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "repo_id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the repository.", }, "repo_name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the repository.", }, "role_name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The team's role name on the repository (pull, triage, push, maintain, admin).", }, }, }, }, "node_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Node ID of the team.", }, "membership_type": { Type: schema.TypeString, Default: "all", Optional: true, ValidateDiagFunc: toDiagFunc(validation.StringInSlice([]string{"all", "immediate"}, false), "membership_type"), + Description: "Type of membership to be requested to fill the list of members (all or immediate).", }, "summary_only": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Exclude the members and repositories of the team from the returned result.", }, "results_per_page": { Type: schema.TypeInt, @@ -95,6 +110,7 @@ func dataSourceGithubTeam() *schema.Resource { Default: 100, ValidateDiagFunc: toDiagFunc(validation.IntBetween(0, 100), "results_per_page"), Deprecated: "This is deprecated and will be removed in a future release.", + Description: "Set the number of results per REST API query (0-100).", }, }, } diff --git a/github/data_source_github_team_test.go b/github/data_source_github_team_test.go index 09c1da4a9c..9a8d86bf42 100644 --- a/github/data_source_github_team_test.go +++ b/github/data_source_github_team_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubTeamDataSource(t *testing.T) { t.Run("queries an existing team without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { @@ -43,7 +43,7 @@ func TestAccGithubTeamDataSource(t *testing.T) { }) t.Run("queries an existing team without error with immediate membership", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { @@ -93,7 +93,7 @@ func TestAccGithubTeamDataSource(t *testing.T) { }) t.Run("queries an existing team without error in summary_only mode", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { @@ -128,7 +128,7 @@ func TestAccGithubTeamDataSource(t *testing.T) { }) t.Run("queries an existing team without error with results_per_page reduced", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { @@ -159,7 +159,7 @@ func TestAccGithubTeamDataSource(t *testing.T) { }) t.Run("get team with repositories without erroring", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-%s", testResourcePrefix, randomID) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -213,7 +213,7 @@ func TestAccGithubTeamDataSource(t *testing.T) { }) t.Run("queries an existing team with connected repositories", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) repoName := fmt.Sprintf("%srepo-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/data_source_github_tree.go b/github/data_source_github_tree.go index 01d95a90f2..9739536a22 100644 --- a/github/data_source_github_tree.go +++ b/github/data_source_github_tree.go @@ -8,48 +8,58 @@ import ( func dataSourceGithubTree() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubTreeRead, + Description: "Use this data source to retrieve the file tree for a repository.", + Read: dataSourceGithubTreeRead, Schema: map[string]*schema.Schema{ "recursive": { - Type: schema.TypeBool, - Default: false, - Optional: true, + Type: schema.TypeBool, + Default: false, + Optional: true, + Description: "Setting this to true returns the objects or subtrees referenced by the tree specified in tree_sha.", }, "repository": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The name of the repository.", }, "entries": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "Objects (of path, mode, type, size, and sha) specifying a tree structure.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "path": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The path of the tree entry relative to its parent tree.", }, "mode": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The file mode (100644 for file, 100755 for executable, 040000 for subdirectory, 160000 for submodule, 120000 for symlink).", }, "type": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The type of the entry (blob, tree, or commit).", }, "size": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The size of the blob in bytes (only present for blobs).", }, "sha": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The SHA1 of the object this tree entry points to.", }, }, }, }, "tree_sha": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The SHA1 value for the tree.", }, }, } diff --git a/github/data_source_github_tree_test.go b/github/data_source_github_tree_test.go index c7fb797e00..3e1b1d07d3 100644 --- a/github/data_source_github_tree_test.go +++ b/github/data_source_github_tree_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubTreeDataSource(t *testing.T) { t.Run("get tree", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-tree-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "this" { diff --git a/github/data_source_github_user.go b/github/data_source_github_user.go index 70938f8ad3..1dbd8310cf 100644 --- a/github/data_source_github_user.go +++ b/github/data_source_github_user.go @@ -9,94 +9,116 @@ import ( func dataSourceGithubUser() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubUserRead, + Description: "Use this data source to retrieve information about a GitHub user.", + Read: dataSourceGithubUserRead, Schema: map[string]*schema.Schema{ "username": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The username. Use an empty string to retrieve information about the currently authenticated user.", }, "login": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The user's login.", }, "avatar_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The user's avatar URL.", }, "gravatar_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The user's gravatar ID.", }, "site_admin": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the user is a GitHub admin.", }, "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The user's full name.", }, "company": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The user's company name.", }, "blog": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The user's blog location.", }, "location": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The user's location.", }, "email": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The user's email.", }, "bio": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The user's bio.", }, "gpg_keys": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "List of user's GPG keys.", }, "ssh_keys": { - Type: schema.TypeList, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "List of user's SSH keys.", }, "public_repos": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The number of public repositories.", }, "public_gists": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The number of public gists.", }, "followers": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The number of followers.", }, "following": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The number of following users.", }, "created_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The creation date.", }, "updated_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The update date.", }, "suspended_at": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The suspended date if the user is suspended.", }, "node_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The Node ID of the user.", }, }, } diff --git a/github/data_source_github_user_external_identity.go b/github/data_source_github_user_external_identity.go index c04723fd24..7fa9dcb249 100644 --- a/github/data_source_github_user_external_identity.go +++ b/github/data_source_github_user_external_identity.go @@ -9,30 +9,35 @@ import ( func dataSourceGithubUserExternalIdentity() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubUserExternalIdentityRead, + Description: "Use this data source to retrieve the external identity for a user in an organization.", + Read: dataSourceGithubUserExternalIdentityRead, Schema: map[string]*schema.Schema{ "username": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + Description: "The username of the member to fetch external identity for.", }, "saml_identity": { - Type: schema.TypeMap, - Computed: true, + Type: schema.TypeMap, + Computed: true, + Description: "An object containing the user's SAML data (name_id, username, family_name, given_name).", Elem: &schema.Schema{ Type: schema.TypeString, }, }, "scim_identity": { - Type: schema.TypeMap, - Computed: true, + Type: schema.TypeMap, + Computed: true, + Description: "An object containing the user's SCIM data (username, family_name, given_name).", Elem: &schema.Schema{ Type: schema.TypeString, }, }, "login": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The username of the GitHub user.", }, }, } diff --git a/github/data_source_github_users.go b/github/data_source_github_users.go index 7168d23dc7..faba28bcc1 100644 --- a/github/data_source_github_users.go +++ b/github/data_source_github_users.go @@ -12,39 +12,45 @@ import ( func dataSourceGithubUsers() *schema.Resource { return &schema.Resource{ - Read: dataSourceGithubUsersRead, + Description: "Use this data source to retrieve information about multiple GitHub users at once.", + Read: dataSourceGithubUsersRead, Schema: map[string]*schema.Schema{ "usernames": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "List of usernames to look up.", Elem: &schema.Schema{ Type: schema.TypeString, }, Required: true, }, "logins": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "List of logins of users that could be found.", Elem: &schema.Schema{ Type: schema.TypeString, }, Computed: true, }, "emails": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "List of the user's publicly visible profile emails (empty string if not shown).", Elem: &schema.Schema{ Type: schema.TypeString, }, Computed: true, }, "node_ids": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "List of Node IDs of users that could be found.", Elem: &schema.Schema{ Type: schema.TypeString, }, Computed: true, }, "unknown_logins": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "List of logins without a matching user.", Elem: &schema.Schema{ Type: schema.TypeString, }, diff --git a/github/resource_github_actions_environment_secret_test.go b/github/resource_github_actions_environment_secret_test.go index 193c8c2209..ad13e9a880 100644 --- a/github/resource_github_actions_environment_secret_test.go +++ b/github/resource_github_actions_environment_secret_test.go @@ -16,7 +16,7 @@ import ( func TestAccGithubActionsEnvironmentSecret(t *testing.T) { t.Run("create_plaintext", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" secretName := "test" @@ -62,7 +62,7 @@ resource "github_actions_environment_secret" "test" { }) t.Run("create_with_env_name_id_separator_character", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "env:test" secretName := "test" @@ -108,7 +108,7 @@ resource "github_actions_environment_secret" "test" { }) t.Run("create_update_plaintext", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" secretName := "test" @@ -168,7 +168,7 @@ resource "github_actions_environment_secret" "test" { }) t.Run("create_update_encrypted", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" secretName := "test" @@ -228,7 +228,7 @@ resource "github_actions_environment_secret" "test" { }) t.Run("create_update_encrypted_with_key", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" secretName := "test" @@ -294,7 +294,7 @@ resource "github_actions_environment_secret" "test" { }) t.Run("update_on_drift", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" secretName := "test" @@ -386,7 +386,7 @@ resource "github_actions_environment_secret" "test" { }) t.Run("lifecycle_can_ignore_drift", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" secretName := "test" @@ -482,7 +482,7 @@ resource "github_actions_environment_secret" "test" { }) t.Run("update_renamed_repo", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) updatedRepoName := fmt.Sprintf("%s%s-updated", testResourcePrefix, randomID) @@ -545,7 +545,7 @@ resource "github_actions_environment_secret" "test" { }) t.Run("recreate_changed_repo", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) repoName2 := fmt.Sprintf("%supdated-%s", testResourcePrefix, randomID) @@ -639,7 +639,7 @@ resource "github_actions_environment_secret" "test" { }) t.Run("destroy", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -676,7 +676,7 @@ resource "github_actions_environment_secret" "test" { }) t.Run("import", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" secretName := "test" diff --git a/github/resource_github_actions_environment_variable_test.go b/github/resource_github_actions_environment_variable_test.go index f0275871dc..2b2ad99ea8 100644 --- a/github/resource_github_actions_environment_variable_test.go +++ b/github/resource_github_actions_environment_variable_test.go @@ -15,7 +15,7 @@ import ( func TestAccGithubActionsEnvironmentVariable(t *testing.T) { t.Run("create", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" varName := "test" @@ -59,7 +59,7 @@ resource "github_actions_environment_variable" "test" { }) t.Run("create_with_env_name_id_separator_character", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "env:test" varName := "test" @@ -103,7 +103,7 @@ resource "github_actions_environment_variable" "test" { }) t.Run("create_update", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" varName := "test" @@ -159,7 +159,7 @@ resource "github_actions_environment_variable" "test" { }) t.Run("update_renamed_repo", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) updatedRepoName := fmt.Sprintf("%s%s-updated", testResourcePrefix, randomID) @@ -222,7 +222,7 @@ resource "github_actions_environment_variable" "test" { }) t.Run("recreate_changed_repo", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) repoName2 := fmt.Sprintf("%supdated-%s", testResourcePrefix, randomID) @@ -316,7 +316,7 @@ resource "github_actions_environment_variable" "test" { }) t.Run("destroy", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -353,7 +353,7 @@ resource "github_actions_environment_variable" "test" { }) t.Run("import", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" varName := "test_variable" @@ -394,7 +394,7 @@ resource "github_actions_environment_variable" "test" { }) t.Run("error_on_existing", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "test" varName := "test_variable" diff --git a/github/resource_github_actions_hosted_runner.go b/github/resource_github_actions_hosted_runner.go index 1629c5c97c..528407fe87 100644 --- a/github/resource_github_actions_hosted_runner.go +++ b/github/resource_github_actions_hosted_runner.go @@ -18,10 +18,11 @@ import ( func resourceGithubActionsHostedRunner() *schema.Resource { return &schema.Resource{ - Create: resourceGithubActionsHostedRunnerCreate, - Read: resourceGithubActionsHostedRunnerRead, - Update: resourceGithubActionsHostedRunnerUpdate, - Delete: resourceGithubActionsHostedRunnerDelete, + Description: "Manages a GitHub Actions hosted runner.", + Create: resourceGithubActionsHostedRunnerCreate, + Read: resourceGithubActionsHostedRunnerRead, + Update: resourceGithubActionsHostedRunnerUpdate, + Delete: resourceGithubActionsHostedRunnerDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_actions_hosted_runner_test.go b/github/resource_github_actions_hosted_runner_test.go index ff510d84aa..18fb0efeea 100644 --- a/github/resource_github_actions_hosted_runner_test.go +++ b/github/resource_github_actions_hosted_runner_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccGithubActionsHostedRunner(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) t.Run("creates hosted runners without error", func(t *testing.T) { config := fmt.Sprintf(` diff --git a/github/resource_github_actions_organization_oidc_subject_claim_customization_template.go b/github/resource_github_actions_organization_oidc_subject_claim_customization_template.go index 336884ecbd..8b9e838bb7 100644 --- a/github/resource_github_actions_organization_oidc_subject_claim_customization_template.go +++ b/github/resource_github_actions_organization_oidc_subject_claim_customization_template.go @@ -9,10 +9,11 @@ import ( func resourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplate() *schema.Resource { return &schema.Resource{ - Create: resourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateCreateOrUpdate, - Read: resourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateRead, - Update: resourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateCreateOrUpdate, - Delete: resourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateDelete, + Description: "Manages the OpenID Connect subject claim customization template for an organization.", + Create: resourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateCreateOrUpdate, + Read: resourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateRead, + Update: resourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateCreateOrUpdate, + Delete: resourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_actions_organization_permissions.go b/github/resource_github_actions_organization_permissions.go index 5106fec01a..9e3ac25c81 100644 --- a/github/resource_github_actions_organization_permissions.go +++ b/github/resource_github_actions_organization_permissions.go @@ -12,10 +12,11 @@ import ( func resourceGithubActionsOrganizationPermissions() *schema.Resource { return &schema.Resource{ - Create: resourceGithubActionsOrganizationPermissionsCreateOrUpdate, - Read: resourceGithubActionsOrganizationPermissionsRead, - Update: resourceGithubActionsOrganizationPermissionsCreateOrUpdate, - Delete: resourceGithubActionsOrganizationPermissionsDelete, + Description: "Manages GitHub Actions permissions for an organization.", + Create: resourceGithubActionsOrganizationPermissionsCreateOrUpdate, + Read: resourceGithubActionsOrganizationPermissionsRead, + Update: resourceGithubActionsOrganizationPermissionsCreateOrUpdate, + Delete: resourceGithubActionsOrganizationPermissionsDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_actions_organization_permissions_test.go b/github/resource_github_actions_organization_permissions_test.go index 8aa3b9516e..08ee23fe04 100644 --- a/github/resource_github_actions_organization_permissions_test.go +++ b/github/resource_github_actions_organization_permissions_test.go @@ -47,7 +47,7 @@ func TestAccGithubActionsOrganizationPermissions(t *testing.T) { githubOwnedAllowed := true verifiedAllowed := true shaPinningRequired := true - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-org-perm-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -188,8 +188,8 @@ func TestAccGithubActionsOrganizationPermissions(t *testing.T) { enabledRepositories := "selected" githubOwnedAllowed := true verifiedAllowed := true - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) - randomID2 := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) + randomID2 := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-org-perm-%s", testResourcePrefix, randomID) repoName2 := fmt.Sprintf("%srepo-act-org-perm-%s", testResourcePrefix, randomID2) diff --git a/github/resource_github_actions_organization_secret.go b/github/resource_github_actions_organization_secret.go index 3600308ad1..bc5c810b74 100644 --- a/github/resource_github_actions_organization_secret.go +++ b/github/resource_github_actions_organization_secret.go @@ -86,6 +86,7 @@ func resourceGithubActionsOrganizationSecret() *schema.Resource { Computed: true, Description: "Date of secret update at the remote.", }, + // lintignore:XS001 // This is deprecated and will be removed in a future version. "destroy_on_drift": { Type: schema.TypeBool, Optional: true, diff --git a/github/resource_github_actions_organization_secret_repositories.go b/github/resource_github_actions_organization_secret_repositories.go index bbeb3f6e4f..3cb21d891b 100644 --- a/github/resource_github_actions_organization_secret_repositories.go +++ b/github/resource_github_actions_organization_secret_repositories.go @@ -10,6 +10,7 @@ import ( func resourceGithubActionsOrganizationSecretRepositories() *schema.Resource { return &schema.Resource{ + Description: "Manages the repository access list for an organization Actions secret.", Schema: map[string]*schema.Schema{ "secret_name": { Type: schema.TypeString, diff --git a/github/resource_github_actions_organization_secret_repositories_test.go b/github/resource_github_actions_organization_secret_repositories_test.go index 276798c569..500736c043 100644 --- a/github/resource_github_actions_organization_secret_repositories_test.go +++ b/github/resource_github_actions_organization_secret_repositories_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubActionsOrganizationSecretRepositories(t *testing.T) { t.Run("create", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) secretName := fmt.Sprintf("test_%s", randomID) secretValue := base64.StdEncoding.EncodeToString([]byte("foo")) repoName0 := fmt.Sprintf("%s%s-0", testResourcePrefix, randomID) diff --git a/github/resource_github_actions_organization_secret_repository.go b/github/resource_github_actions_organization_secret_repository.go index b73c839882..7637eedda1 100644 --- a/github/resource_github_actions_organization_secret_repository.go +++ b/github/resource_github_actions_organization_secret_repository.go @@ -12,6 +12,7 @@ import ( func resourceGithubActionsOrganizationSecretRepository() *schema.Resource { return &schema.Resource{ + Description: "Manages a repository's access to an organization Actions secret.", Schema: map[string]*schema.Schema{ "secret_name": { Type: schema.TypeString, diff --git a/github/resource_github_actions_organization_secret_repository_test.go b/github/resource_github_actions_organization_secret_repository_test.go index d7dec7d116..818666c652 100644 --- a/github/resource_github_actions_organization_secret_repository_test.go +++ b/github/resource_github_actions_organization_secret_repository_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubActionsOrganizationSecretRepository(t *testing.T) { t.Run("create", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) secretName := fmt.Sprintf("test_%s", randomID) secretValue := base64.StdEncoding.EncodeToString([]byte("foo")) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) diff --git a/github/resource_github_actions_organization_secret_test.go b/github/resource_github_actions_organization_secret_test.go index 782802b214..03627c8372 100644 --- a/github/resource_github_actions_organization_secret_test.go +++ b/github/resource_github_actions_organization_secret_test.go @@ -258,8 +258,8 @@ resource "github_actions_organization_secret" "test" { }) t.Run("create_update_visibility_selected", func(t *testing.T) { - repoName0 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)) - repoName1 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)) + repoName0 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandString(5)) + repoName1 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandString(5)) randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlpha) secretName := fmt.Sprintf("test_%s", randomID) value := base64.StdEncoding.EncodeToString([]byte("foo")) @@ -627,7 +627,7 @@ resource "github_actions_organization_secret" "test" { }) t.Run("error_on_invalid_selected_repository_ids", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlpha) + randomID := acctest.RandString(5) secretName := fmt.Sprintf("test_%s", randomID) value := base64.StdEncoding.EncodeToString([]byte("foo")) diff --git a/github/resource_github_actions_organization_variable.go b/github/resource_github_actions_organization_variable.go index 47d55e3c02..ac1f370b91 100644 --- a/github/resource_github_actions_organization_variable.go +++ b/github/resource_github_actions_organization_variable.go @@ -14,6 +14,7 @@ import ( func resourceGithubActionsOrganizationVariable() *schema.Resource { return &schema.Resource{ + Description: "Manages a GitHub Actions variable within an organization.", Schema: map[string]*schema.Schema{ "variable_name": { Type: schema.TypeString, diff --git a/github/resource_github_actions_organization_variable_repositories_test.go b/github/resource_github_actions_organization_variable_repositories_test.go index 39c1a84ecf..3d6ed2332d 100644 --- a/github/resource_github_actions_organization_variable_repositories_test.go +++ b/github/resource_github_actions_organization_variable_repositories_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubActionsOrganizationVariableRepositories(t *testing.T) { t.Run("create", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) variableName := fmt.Sprintf("test_%s", randomID) variableValue := "foo" repoName0 := fmt.Sprintf("%s%s-0", testResourcePrefix, randomID) diff --git a/github/resource_github_actions_organization_variable_repository_test.go b/github/resource_github_actions_organization_variable_repository_test.go index e5d99ec490..595515428c 100644 --- a/github/resource_github_actions_organization_variable_repository_test.go +++ b/github/resource_github_actions_organization_variable_repository_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubActionsOrganizationVariableRepository(t *testing.T) { t.Run("create", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) variableName := fmt.Sprintf("test_%s", randomID) variableValue := "foo" repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) diff --git a/github/resource_github_actions_organization_variable_test.go b/github/resource_github_actions_organization_variable_test.go index bbc32793aa..fd52111811 100644 --- a/github/resource_github_actions_organization_variable_test.go +++ b/github/resource_github_actions_organization_variable_test.go @@ -14,7 +14,7 @@ import ( func TestAccGithubActionsOrganizationVariable(t *testing.T) { t.Run("create_update_visibility_all", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlpha) + randomID := acctest.RandString(5) varName := fmt.Sprintf("test_%s", randomID) value := "foo" valueUpdated := "bar" @@ -102,8 +102,8 @@ resource "github_actions_organization_variable" "test" { }) t.Run("create_update_visibility_selected", func(t *testing.T) { - repoName0 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)) - repoName1 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)) + repoName0 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandString(5)) + repoName1 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandString(5)) randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlpha) varName := fmt.Sprintf("test_%s", randomID) value := "foo" diff --git a/github/resource_github_actions_repository_access_level.go b/github/resource_github_actions_repository_access_level.go index b31f9ad136..e7869306cb 100644 --- a/github/resource_github_actions_repository_access_level.go +++ b/github/resource_github_actions_repository_access_level.go @@ -10,10 +10,11 @@ import ( func resourceGithubActionsRepositoryAccessLevel() *schema.Resource { return &schema.Resource{ - Create: resourceGithubActionsRepositoryAccessLevelCreateOrUpdate, - Read: resourceGithubActionsRepositoryAccessLevelRead, - Update: resourceGithubActionsRepositoryAccessLevelCreateOrUpdate, - Delete: resourceGithubActionsRepositoryAccessLevelDelete, + Description: "Manages the access level for a repository's actions and workflows.", + Create: resourceGithubActionsRepositoryAccessLevelCreateOrUpdate, + Read: resourceGithubActionsRepositoryAccessLevelRead, + Update: resourceGithubActionsRepositoryAccessLevelCreateOrUpdate, + Delete: resourceGithubActionsRepositoryAccessLevelDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_actions_repository_access_level_test.go b/github/resource_github_actions_repository_access_level_test.go index e370a889f2..90c887a770 100644 --- a/github/resource_github_actions_repository_access_level_test.go +++ b/github/resource_github_actions_repository_access_level_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubActionsRepositoryAccessLevel(t *testing.T) { t.Run("test setting of user action access level", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-access-%s", testResourcePrefix, randomID) accessLevel := "user" config := fmt.Sprintf(` @@ -46,7 +46,7 @@ func TestAccGithubActionsRepositoryAccessLevel(t *testing.T) { }) t.Run("test setting of organization action access level", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-access-%s", testResourcePrefix, randomID) accessLevel := "organization" config := fmt.Sprintf(` diff --git a/github/resource_github_actions_repository_oidc_subject_claim_customization_template.go b/github/resource_github_actions_repository_oidc_subject_claim_customization_template.go index c973ca03bd..c0783a772a 100644 --- a/github/resource_github_actions_repository_oidc_subject_claim_customization_template.go +++ b/github/resource_github_actions_repository_oidc_subject_claim_customization_template.go @@ -11,10 +11,11 @@ import ( func resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplate() *schema.Resource { return &schema.Resource{ - Create: resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateCreateOrUpdate, - Read: resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateRead, - Update: resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateCreateOrUpdate, - Delete: resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDelete, + Description: "Manages the OpenID Connect subject claim customization template for a repository.", + Create: resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateCreateOrUpdate, + Read: resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateRead, + Update: resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateCreateOrUpdate, + Delete: resourceGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplateDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_actions_repository_oidc_subject_claim_customization_template_test.go b/github/resource_github_actions_repository_oidc_subject_claim_customization_template_test.go index 89f359a770..64dde8582c 100644 --- a/github/resource_github_actions_repository_oidc_subject_claim_customization_template_test.go +++ b/github/resource_github_actions_repository_oidc_subject_claim_customization_template_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplate(t *testing.T) { t.Run("creates repository oidc subject claim customization template without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-oidc-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -58,7 +58,7 @@ func TestAccGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplate(t *test }) t.Run("updates repository oidc subject claim customization template without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-oidc-%s", testResourcePrefix, randomID) configTemplate := ` resource "github_repository" "test" { @@ -172,7 +172,7 @@ func TestAccGithubActionsRepositoryOIDCSubjectClaimCustomizationTemplate(t *test }) t.Run("imports repository oidc subject claim customization template without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-oidc-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_actions_repository_permissions.go b/github/resource_github_actions_repository_permissions.go index 57cbace461..c6cc999096 100644 --- a/github/resource_github_actions_repository_permissions.go +++ b/github/resource_github_actions_repository_permissions.go @@ -11,10 +11,11 @@ import ( func resourceGithubActionsRepositoryPermissions() *schema.Resource { return &schema.Resource{ - Create: resourceGithubActionsRepositoryPermissionsCreateOrUpdate, - Read: resourceGithubActionsRepositoryPermissionsRead, - Update: resourceGithubActionsRepositoryPermissionsCreateOrUpdate, - Delete: resourceGithubActionsRepositoryPermissionsDelete, + Description: "Manages GitHub Actions permissions for a repository.", + Create: resourceGithubActionsRepositoryPermissionsCreateOrUpdate, + Read: resourceGithubActionsRepositoryPermissionsRead, + Update: resourceGithubActionsRepositoryPermissionsCreateOrUpdate, + Delete: resourceGithubActionsRepositoryPermissionsDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_actions_repository_permissions_test.go b/github/resource_github_actions_repository_permissions_test.go index a64352a57c..961749151d 100644 --- a/github/resource_github_actions_repository_permissions_test.go +++ b/github/resource_github_actions_repository_permissions_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubActionsRepositoryPermissions(t *testing.T) { t.Run("test setting of basic actions repository permissions", func(t *testing.T) { allowedActions := "local_only" - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-perms-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -50,7 +50,7 @@ func TestAccGithubActionsRepositoryPermissions(t *testing.T) { githubOwnedAllowed := true verifiedAllowed := true shaPinningRequired := true - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-perms-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -102,7 +102,7 @@ func TestAccGithubActionsRepositoryPermissions(t *testing.T) { allowedActions := "selected" githubOwnedAllowed := true verifiedAllowed := true - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-perms-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -146,7 +146,7 @@ func TestAccGithubActionsRepositoryPermissions(t *testing.T) { t.Run("test not setting of repository allowed actions without error", func(t *testing.T) { allowedActions := "selected" - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-perms-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -187,7 +187,7 @@ func TestAccGithubActionsRepositoryPermissions(t *testing.T) { t.Run("test disabling actions on a repository", func(t *testing.T) { actionsEnabled := false - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-perms-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -223,7 +223,7 @@ func TestAccGithubActionsRepositoryPermissions(t *testing.T) { // https://github.com/integrations/terraform-provider-github/issues/2182 t.Run("test load with disabled actions", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-perms-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_actions_runner_group.go b/github/resource_github_actions_runner_group.go index 394ff56a1c..01ac9c9fa0 100644 --- a/github/resource_github_actions_runner_group.go +++ b/github/resource_github_actions_runner_group.go @@ -15,10 +15,11 @@ import ( func resourceGithubActionsRunnerGroup() *schema.Resource { return &schema.Resource{ - Create: resourceGithubActionsRunnerGroupCreate, - Read: resourceGithubActionsRunnerGroupRead, - Update: resourceGithubActionsRunnerGroupUpdate, - Delete: resourceGithubActionsRunnerGroupDelete, + Description: "Manages a GitHub Actions runner group within an organization.", + Create: resourceGithubActionsRunnerGroupCreate, + Read: resourceGithubActionsRunnerGroupRead, + Update: resourceGithubActionsRunnerGroupUpdate, + Delete: resourceGithubActionsRunnerGroupDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_actions_runner_group_test.go b/github/resource_github_actions_runner_group_test.go index a399e5f140..6abf0b1237 100644 --- a/github/resource_github_actions_runner_group_test.go +++ b/github/resource_github_actions_runner_group_test.go @@ -13,7 +13,7 @@ import ( func TestAccGithubActionsRunnerGroup(t *testing.T) { t.Run("creates runner groups without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-runner-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -98,7 +98,7 @@ func TestAccGithubActionsRunnerGroup(t *testing.T) { }) t.Run("manages runner visibility", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-runner-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -146,7 +146,7 @@ func TestAccGithubActionsRunnerGroup(t *testing.T) { }) t.Run("imports an all runner group without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-runner-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -190,7 +190,7 @@ func TestAccGithubActionsRunnerGroup(t *testing.T) { // Based on GitHub UI there is no way to create a private runner group t.Skip("This is not supported") - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-runner-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -227,7 +227,7 @@ func TestAccGithubActionsRunnerGroup(t *testing.T) { }) t.Run("imports a selected runner group without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-act-runner-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_actions_secret.go b/github/resource_github_actions_secret.go index fbd6e2932e..04b518a13b 100644 --- a/github/resource_github_actions_secret.go +++ b/github/resource_github_actions_secret.go @@ -85,6 +85,7 @@ func resourceGithubActionsSecret() *schema.Resource { Computed: true, Description: "Date of secret update at the remote.", }, + // lintignore:XS001 // This is deprecated and will be removed in a future version. "destroy_on_drift": { Type: schema.TypeBool, Optional: true, diff --git a/github/resource_github_actions_secret_test.go b/github/resource_github_actions_secret_test.go index 3c47224af9..0e0e6a768d 100644 --- a/github/resource_github_actions_secret_test.go +++ b/github/resource_github_actions_secret_test.go @@ -14,7 +14,7 @@ import ( func TestAccGithubActionsSecret(t *testing.T) { t.Run("create_plaintext", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" value := base64.StdEncoding.EncodeToString([]byte("super_secret_value")) @@ -52,7 +52,7 @@ resource "github_actions_secret" "test" { }) t.Run("create_update_plaintext", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" value := base64.StdEncoding.EncodeToString([]byte("super_secret_value")) @@ -103,7 +103,7 @@ resource "github_actions_secret" "test" { }) t.Run("create_update_encrypted", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" value := base64.StdEncoding.EncodeToString([]byte("super_secret_value")) @@ -154,7 +154,7 @@ resource "github_actions_secret" "test" { }) t.Run("create_update_encrypted_with_key", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" value := base64.StdEncoding.EncodeToString([]byte("super_secret_value")) @@ -210,7 +210,7 @@ resource "github_actions_secret" "test" { }) t.Run("update_on_drift", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" @@ -287,7 +287,7 @@ resource "github_actions_secret" "test" { }) t.Run("lifecycle_can_ignore_drift", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" @@ -368,7 +368,7 @@ resource "github_actions_secret" "test" { }) t.Run("update_renamed_repo", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) updatedRepoName := fmt.Sprintf("%s%s-updated", testResourcePrefix, randomID) @@ -420,7 +420,7 @@ resource "github_actions_secret" "test" { }) t.Run("recreate_changed_repo", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) repoName2 := fmt.Sprintf("%supdated-%s", testResourcePrefix, randomID) @@ -492,7 +492,7 @@ resource "github_actions_secret" "test" { }) t.Run("destroy", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -523,7 +523,7 @@ resource "github_actions_secret" "test" { }) t.Run("import", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" diff --git a/github/resource_github_actions_variable.go b/github/resource_github_actions_variable.go index 32ae69a09e..03be6c8013 100644 --- a/github/resource_github_actions_variable.go +++ b/github/resource_github_actions_variable.go @@ -13,6 +13,7 @@ import ( func resourceGithubActionsVariable() *schema.Resource { return &schema.Resource{ + Description: "Manages a GitHub Actions variable within a repository.", SchemaVersion: 1, StateUpgraders: []schema.StateUpgrader{ { diff --git a/github/resource_github_actions_variable_test.go b/github/resource_github_actions_variable_test.go index dc732f4296..c1fc9ed3da 100644 --- a/github/resource_github_actions_variable_test.go +++ b/github/resource_github_actions_variable_test.go @@ -15,7 +15,7 @@ import ( func TestAccGithubActionsVariable(t *testing.T) { t.Run("create", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) varName := "test" value := "foo" @@ -51,7 +51,7 @@ resource "github_actions_variable" "test" { }) t.Run("create_update", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) varName := "test" value := "foo" @@ -98,7 +98,7 @@ resource "github_actions_variable" "test" { }) t.Run("update_renamed_repo", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) updatedRepoName := fmt.Sprintf("%s%s-updated", testResourcePrefix, randomID) @@ -150,7 +150,7 @@ resource "github_actions_variable" "test" { }) t.Run("recreate_changed_repo", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) repoName2 := fmt.Sprintf("%supdated-%s", testResourcePrefix, randomID) @@ -222,7 +222,7 @@ resource "github_actions_variable" "test" { }) t.Run("destroy", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -253,7 +253,7 @@ resource "github_actions_variable" "test" { }) t.Run("import", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -285,7 +285,7 @@ resource "github_actions_variable" "test" { }) t.Run("error_on_existing", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) varName := "test" diff --git a/github/resource_github_app_installation_repositories.go b/github/resource_github_app_installation_repositories.go index aac67565b3..1213cf7ba9 100644 --- a/github/resource_github_app_installation_repositories.go +++ b/github/resource_github_app_installation_repositories.go @@ -11,10 +11,11 @@ import ( func resourceGithubAppInstallationRepositories() *schema.Resource { return &schema.Resource{ - Create: resourceGithubAppInstallationRepositoriesCreateOrUpdate, - Read: resourceGithubAppInstallationRepositoriesRead, - Update: resourceGithubAppInstallationRepositoriesCreateOrUpdate, - Delete: resourceGithubAppInstallationRepositoriesDelete, + Description: "Manages the repository access list for a GitHub App installation.", + Create: resourceGithubAppInstallationRepositoriesCreateOrUpdate, + Read: resourceGithubAppInstallationRepositoriesRead, + Update: resourceGithubAppInstallationRepositoriesCreateOrUpdate, + Delete: resourceGithubAppInstallationRepositoriesDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_app_installation_repositories_test.go b/github/resource_github_app_installation_repositories_test.go index e0c2e3c915..8b4d99c86f 100644 --- a/github/resource_github_app_installation_repositories_test.go +++ b/github/resource_github_app_installation_repositories_test.go @@ -15,7 +15,7 @@ func TestAccGithubAppInstallationRepositories(t *testing.T) { } t.Run("installs an app to multiple repositories", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName0 := fmt.Sprintf("%srepo-app-install-0-%s", testResourcePrefix, randomID) repoName1 := fmt.Sprintf("%srepo-app-install-1-%s", testResourcePrefix, randomID) diff --git a/github/resource_github_app_installation_repository.go b/github/resource_github_app_installation_repository.go index 07348b951c..13035c3dd5 100644 --- a/github/resource_github_app_installation_repository.go +++ b/github/resource_github_app_installation_repository.go @@ -11,9 +11,10 @@ import ( func resourceGithubAppInstallationRepository() *schema.Resource { return &schema.Resource{ - Create: resourceGithubAppInstallationRepositoryCreate, - Read: resourceGithubAppInstallationRepositoryRead, - Delete: resourceGithubAppInstallationRepositoryDelete, + Description: "Manages a repository's access to a GitHub App installation.", + Create: resourceGithubAppInstallationRepositoryCreate, + Read: resourceGithubAppInstallationRepositoryRead, + Delete: resourceGithubAppInstallationRepositoryDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -32,8 +33,9 @@ func resourceGithubAppInstallationRepository() *schema.Resource { Description: "The repository to install the app on.", }, "repo_id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The ID of the repository.", }, }, } diff --git a/github/resource_github_app_installation_repository_test.go b/github/resource_github_app_installation_repository_test.go index 46f11e71c8..b698d5e537 100644 --- a/github/resource_github_app_installation_repository_test.go +++ b/github/resource_github_app_installation_repository_test.go @@ -15,7 +15,7 @@ func TestAccGithubAppInstallationRepository(t *testing.T) { } t.Run("installs an app to a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-app-install-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_branch.go b/github/resource_github_branch.go index d7c34d36bd..b1f77cd544 100644 --- a/github/resource_github_branch.go +++ b/github/resource_github_branch.go @@ -14,10 +14,11 @@ import ( func resourceGithubBranch() *schema.Resource { return &schema.Resource{ - Create: resourceGithubBranchCreate, - Read: resourceGithubBranchRead, - Update: resourceGithubBranchUpdate, - Delete: resourceGithubBranchDelete, + Description: "Manages a branch within a repository.", + Create: resourceGithubBranchCreate, + Read: resourceGithubBranchRead, + Update: resourceGithubBranchUpdate, + Delete: resourceGithubBranchDelete, Importer: &schema.ResourceImporter{ State: resourceGithubBranchImport, }, @@ -92,7 +93,7 @@ func resourceGithubBranchCreate(d *schema.ResourceData, meta any) error { return fmt.Errorf("error querying GitHub branch reference %s/%s (%s): %w", orgName, repoName, sourceBranchRefName, err) } - if err = d.Set("source_sha", *ref.Object.SHA); err != nil { + if err = d.Set("source_sha", ref.Object.SHA); err != nil { return err } } @@ -156,10 +157,10 @@ func resourceGithubBranchRead(d *schema.ResourceData, meta any) error { if err = d.Set("branch", branchName); err != nil { return err } - if err = d.Set("ref", *ref.Ref); err != nil { + if err = d.Set("ref", ref.Ref); err != nil { return err } - if err = d.Set("sha", *ref.Object.SHA); err != nil { + if err = d.Set("sha", ref.Object.SHA); err != nil { return err } diff --git a/github/resource_github_branch_default.go b/github/resource_github_branch_default.go index b137d92730..41a83fa603 100644 --- a/github/resource_github_branch_default.go +++ b/github/resource_github_branch_default.go @@ -12,10 +12,11 @@ import ( func resourceGithubBranchDefault() *schema.Resource { return &schema.Resource{ - Create: resourceGithubBranchDefaultCreate, - Read: resourceGithubBranchDefaultRead, - Delete: resourceGithubBranchDefaultDelete, - Update: resourceGithubBranchDefaultUpdate, + Description: "Manages the default branch for a repository.", + Create: resourceGithubBranchDefaultCreate, + Read: resourceGithubBranchDefaultRead, + Delete: resourceGithubBranchDefaultDelete, + Update: resourceGithubBranchDefaultUpdate, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -39,9 +40,10 @@ func resourceGithubBranchDefault() *schema.Resource { Description: "Indicate if it should rename the branch rather than use an existing branch. Defaults to 'false'.", }, "etag": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "An etag representing the default branch object.", DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool { return true }, @@ -119,8 +121,8 @@ func resourceGithubBranchDefaultRead(d *schema.ResourceData, meta any) error { } _ = d.Set("etag", resp.Header.Get("ETag")) - _ = d.Set("branch", *repository.DefaultBranch) - _ = d.Set("repository", *repository.Name) + _ = d.Set("branch", repository.DefaultBranch) + _ = d.Set("repository", repository.Name) return nil } diff --git a/github/resource_github_branch_default_test.go b/github/resource_github_branch_default_test.go index 47855e32b4..535e02df6b 100644 --- a/github/resource_github_branch_default_test.go +++ b/github/resource_github_branch_default_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubBranchDefault(t *testing.T) { t.Run("creates and manages branch defaults", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-branch-def-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -49,7 +49,7 @@ func TestAccGithubBranchDefault(t *testing.T) { }) t.Run("replaces the default_branch of a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-branch-def-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -97,7 +97,7 @@ func TestAccGithubBranchDefault(t *testing.T) { }) t.Run("creates and manages branch defaults even if rename is set", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-branch-def-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -136,7 +136,7 @@ func TestAccGithubBranchDefault(t *testing.T) { }) t.Run("replaces the default_branch of a repository without creating a branch resource prior to", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-branch-def-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_branch_protection.go b/github/resource_github_branch_protection.go index 8d4bbc2b2b..0846a9d222 100644 --- a/github/resource_github_branch_protection.go +++ b/github/resource_github_branch_protection.go @@ -13,6 +13,7 @@ import ( func resourceGithubBranchProtection() *schema.Resource { return &schema.Resource{ + Description: "Manages a branch protection rule for a repository using the GraphQL API.", SchemaVersion: 2, Schema: map[string]*schema.Schema{ @@ -293,37 +294,37 @@ func resourceGithubBranchProtectionRead(d *schema.ResourceData, meta any) error } protection := query.Node.Node - err = d.Set(PROTECTION_PATTERN, protection.Pattern) + err = d.Set("pattern", protection.Pattern) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_PATTERN, protection.Repository.Name, protection.Pattern, d.Id()) } - err = d.Set(PROTECTION_ALLOWS_DELETIONS, protection.AllowsDeletions) + err = d.Set("allows_deletions", protection.AllowsDeletions) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_ALLOWS_DELETIONS, protection.Repository.Name, protection.Pattern, d.Id()) } - err = d.Set(PROTECTION_ALLOWS_FORCE_PUSHES, protection.AllowsForcePushes) + err = d.Set("allows_force_pushes", protection.AllowsForcePushes) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_ALLOWS_FORCE_PUSHES, protection.Repository.Name, protection.Pattern, d.Id()) } - err = d.Set(PROTECTION_IS_ADMIN_ENFORCED, protection.IsAdminEnforced) + err = d.Set("enforce_admins", protection.IsAdminEnforced) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_IS_ADMIN_ENFORCED, protection.Repository.Name, protection.Pattern, d.Id()) } - err = d.Set(PROTECTION_REQUIRES_COMMIT_SIGNATURES, protection.RequiresCommitSignatures) + err = d.Set("require_signed_commits", protection.RequiresCommitSignatures) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_REQUIRES_COMMIT_SIGNATURES, protection.Repository.Name, protection.Pattern, d.Id()) } - err = d.Set(PROTECTION_REQUIRES_LINEAR_HISTORY, protection.RequiresLinearHistory) + err = d.Set("required_linear_history", protection.RequiresLinearHistory) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_REQUIRES_LINEAR_HISTORY, protection.Repository.Name, protection.Pattern, d.Id()) } - err = d.Set(PROTECTION_REQUIRES_CONVERSATION_RESOLUTION, protection.RequiresConversationResolution) + err = d.Set("require_conversation_resolution", protection.RequiresConversationResolution) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_REQUIRES_CONVERSATION_RESOLUTION, protection.Repository.Name, protection.Pattern, d.Id()) } @@ -334,30 +335,30 @@ func resourceGithubBranchProtectionRead(d *schema.ResourceData, meta any) error } approvingReviews := setApprovingReviews(protection, data, meta) - err = d.Set(PROTECTION_REQUIRES_APPROVING_REVIEWS, approvingReviews) + err = d.Set("required_pull_request_reviews", approvingReviews) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_REQUIRES_APPROVING_REVIEWS, protection.Repository.Name, protection.Pattern, d.Id()) } statusChecks := setStatusChecks(protection) - err = d.Set(PROTECTION_REQUIRES_STATUS_CHECKS, statusChecks) + err = d.Set("required_status_checks", statusChecks) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_REQUIRES_STATUS_CHECKS, protection.Repository.Name, protection.Pattern, d.Id()) } restrictsPushes := setPushes(protection, data, meta) - err = d.Set(PROTECTION_RESTRICTS_PUSHES, restrictsPushes) + err = d.Set("restrict_pushes", restrictsPushes) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_RESTRICTS_PUSHES, protection.Repository.Name, protection.Pattern, d.Id()) } forcePushBypassers := setForcePushBypassers(protection, data, meta) - err = d.Set(PROTECTION_FORCE_PUSHES_BYPASSERS, forcePushBypassers) + err = d.Set("force_push_bypassers", forcePushBypassers) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_FORCE_PUSHES_BYPASSERS, protection.Repository.Name, protection.Pattern, d.Id()) } - err = d.Set(PROTECTION_LOCK_BRANCH, protection.LockBranch) + err = d.Set("lock_branch", protection.LockBranch) if err != nil { log.Printf("[DEBUG] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_LOCK_BRANCH, protection.Repository.Name, protection.Pattern, d.Id()) } diff --git a/github/resource_github_branch_protection_migration.go b/github/resource_github_branch_protection_migration.go index 09808970ad..4c5effa7c7 100644 --- a/github/resource_github_branch_protection_migration.go +++ b/github/resource_github_branch_protection_migration.go @@ -10,14 +10,16 @@ func resourceGithubBranchProtectionV0() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The name of the repository.", }, "branch": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The branch name or pattern to protect.", }, }, } @@ -47,14 +49,16 @@ func resourceGithubBranchProtectionV1() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "push_restrictions": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "The list of actor Names/IDs that may push to the branch.", }, "blocks_creations": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Setting this to true will block creating the branch.", }, }, } diff --git a/github/resource_github_branch_protection_test.go b/github/resource_github_branch_protection_test.go index 6fa000258d..815f3dda6f 100644 --- a/github/resource_github_branch_protection_test.go +++ b/github/resource_github_branch_protection_test.go @@ -14,7 +14,7 @@ import ( func TestAccGithubBranchProtectionV4(t *testing.T) { t.Run("configures default settings when empty", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -88,7 +88,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures default settings when conversation resolution is true", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -165,7 +165,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures required status checks", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -223,7 +223,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures required pull request reviews", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -278,7 +278,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures branch push restrictions", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -320,7 +320,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures branch push restrictions with node_id", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -370,7 +370,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures branch push restrictions with username", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -416,7 +416,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures branch push restrictions with blocksCreations false", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -460,7 +460,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures force pushes and deletions", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -505,7 +505,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures non-empty list of force push bypassers", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -550,7 +550,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures allow force push with a team as bypasser", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) repoName := teamName config := fmt.Sprintf(` @@ -603,7 +603,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures empty list of force push bypassers", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -643,7 +643,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures non-empty list of pull request bypassers", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -686,7 +686,7 @@ func TestAccGithubBranchProtectionV4(t *testing.T) { }) t.Run("configures empty list of pull request bypassers", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_branch_protection_v3.go b/github/resource_github_branch_protection_v3.go index e238def1fd..ee2b8d9e1f 100644 --- a/github/resource_github_branch_protection_v3.go +++ b/github/resource_github_branch_protection_v3.go @@ -14,10 +14,11 @@ import ( func resourceGithubBranchProtectionV3() *schema.Resource { return &schema.Resource{ - Create: resourceGithubBranchProtectionV3Create, - Read: resourceGithubBranchProtectionV3Read, - Update: resourceGithubBranchProtectionV3Update, - Delete: resourceGithubBranchProtectionV3Delete, + Description: "Manages a branch protection rule for a repository using the REST API (v3).", + Create: resourceGithubBranchProtectionV3Create, + Read: resourceGithubBranchProtectionV3Read, + Update: resourceGithubBranchProtectionV3Update, + Delete: resourceGithubBranchProtectionV3Delete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -43,10 +44,11 @@ func resourceGithubBranchProtectionV3() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_admins": { - Type: schema.TypeBool, - Optional: true, - Default: false, - Deprecated: "Use enforce_admins instead", + Type: schema.TypeBool, + Optional: true, + Default: false, + Deprecated: "Use enforce_admins instead", + Description: "Deprecated: Use enforce_admins instead.", DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool { return true }, @@ -58,10 +60,11 @@ func resourceGithubBranchProtectionV3() *schema.Resource { Description: "Require branches to be up to date before merging.", }, "contexts": { - Type: schema.TypeSet, - Optional: true, - Computed: true, - Deprecated: "GitHub is deprecating the use of `contexts`. Use a `checks` array instead.", + Type: schema.TypeSet, + Optional: true, + Computed: true, + Deprecated: "GitHub is deprecating the use of `contexts`. Use a `checks` array instead.", + Description: "Deprecated: Use checks instead. The list of status checks to require.", Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -88,10 +91,11 @@ func resourceGithubBranchProtectionV3() *schema.Resource { Schema: map[string]*schema.Schema{ // FIXME: Remove this deprecated field "include_admins": { - Type: schema.TypeBool, - Optional: true, - Default: false, - Deprecated: "Use enforce_admins instead", + Type: schema.TypeBool, + Optional: true, + Default: false, + Deprecated: "Use enforce_admins instead", + Description: "Deprecated: Use enforce_admins instead.", DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool { return true }, @@ -139,25 +143,29 @@ func resourceGithubBranchProtectionV3() *schema.Resource { Description: "Require that the most recent push must be approved by someone other than the last pusher.", }, "bypass_pull_request_allowances": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Description: "Allow specific users, teams, or apps to bypass pull request requirements.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "users": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "The list of user logins allowed to bypass pull request requirements.", }, "teams": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "The list of team slugs allowed to bypass pull request requirements.", }, "apps": { - Type: schema.TypeSet, - Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "The list of app slugs allowed to bypass pull request requirements.", }, }, }, @@ -212,8 +220,9 @@ func resourceGithubBranchProtectionV3() *schema.Resource { Description: "Setting this to 'true' requires all conversations on code must be resolved before a pull request can be merged.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the branch protection object.", }, }, } diff --git a/github/resource_github_branch_protection_v3_test.go b/github/resource_github_branch_protection_v3_test.go index 6ef6f8cb82..65fdad6ea5 100644 --- a/github/resource_github_branch_protection_v3_test.go +++ b/github/resource_github_branch_protection_v3_test.go @@ -9,7 +9,7 @@ import ( ) func TestAccGithubBranchProtectionV3_required_pull_request_reviews(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) repoName := fmt.Sprintf("%srepo-%s", testResourcePrefix, randomID) t.Run("configures required pull request reviews", func(t *testing.T) { @@ -107,7 +107,7 @@ func TestAccGithubBranchProtectionV3_required_pull_request_reviews(t *testing.T) } func TestAccGithubBranchProtectionV3RequiredPullRequestReviewsBypassAllowances(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) repoName := fmt.Sprintf("%srepo-%s", testResourcePrefix, randomID) t.Run("configures required pull request reviews with bypass allowances", func(t *testing.T) { @@ -166,7 +166,7 @@ func TestAccGithubBranchProtectionV3RequiredPullRequestReviewsBypassAllowances(t } func TestAccGithubBranchProtectionV3_branch_push_restrictions(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) repoName := fmt.Sprintf("%srepo-%s", testResourcePrefix, randomID) t.Run("configures branch push restrictions", func(t *testing.T) { @@ -219,7 +219,7 @@ func TestAccGithubBranchProtectionV3_branch_push_restrictions(t *testing.T) { func TestAccGithubBranchProtectionV3_computed_status_checks_no_churn(t *testing.T) { t.Run("handles computed status checks without churn", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -281,7 +281,7 @@ func TestAccGithubBranchProtectionV3_computed_status_checks_no_churn(t *testing. func TestAccGithubBranchProtectionV3_computed_status_contexts_no_churn(t *testing.T) { t.Run("handles computed status contexts without churn", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -342,7 +342,7 @@ func TestAccGithubBranchProtectionV3_computed_status_contexts_no_churn(t *testin func TestAccGithubBranchProtectionV3(t *testing.T) { t.Run("configures default settings when empty", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -378,7 +378,7 @@ func TestAccGithubBranchProtectionV3(t *testing.T) { }) t.Run("configures conversation resolution", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -415,7 +415,7 @@ func TestAccGithubBranchProtectionV3(t *testing.T) { }) t.Run("configures required status checks", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -458,7 +458,7 @@ func TestAccGithubBranchProtectionV3(t *testing.T) { }) t.Run("configures required status checks context", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -496,7 +496,7 @@ func TestAccGithubBranchProtectionV3(t *testing.T) { }) t.Run("configures required pull request reviews", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -591,7 +591,7 @@ func TestAccGithubBranchProtectionV3(t *testing.T) { }) t.Run("configures required pull request reviews with bypass allowances", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testResourceName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -647,7 +647,7 @@ func TestAccGithubBranchProtectionV3(t *testing.T) { }) t.Run("configures branch push restrictions", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testResourceName := fmt.Sprintf("%sbranch-protection-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_branch_test.go b/github/resource_github_branch_test.go index b79af29781..095d635021 100644 --- a/github/resource_github_branch_test.go +++ b/github/resource_github_branch_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubBranch(t *testing.T) { t.Run("creates a branch directly", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-branch-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -41,7 +41,7 @@ func TestAccGithubBranch(t *testing.T) { }) t.Run("creates a branch named main directly and a repository with a gitignore template", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-branch-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -81,7 +81,7 @@ func TestAccGithubBranch(t *testing.T) { }) t.Run("creates a branch from a source branch", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-branch-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -118,7 +118,7 @@ func TestAccGithubBranch(t *testing.T) { }) t.Run("renames a branch without replacement", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-branch-%s", testResourcePrefix, randomID) initialConfig := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_codespaces_organization_secret.go b/github/resource_github_codespaces_organization_secret.go index 89b428b361..b84ecd0e7b 100644 --- a/github/resource_github_codespaces_organization_secret.go +++ b/github/resource_github_codespaces_organization_secret.go @@ -15,9 +15,10 @@ import ( func resourceGithubCodespacesOrganizationSecret() *schema.Resource { return &schema.Resource{ - Create: resourceGithubCodespacesOrganizationSecretCreateOrUpdate, - Read: resourceGithubCodespacesOrganizationSecretRead, - Delete: resourceGithubCodespacesOrganizationSecretDelete, + Description: "Manages a Codespaces secret within an organization.", + Create: resourceGithubCodespacesOrganizationSecretCreateOrUpdate, + Read: resourceGithubCodespacesOrganizationSecretRead, + Delete: resourceGithubCodespacesOrganizationSecretDelete, Importer: &schema.ResourceImporter{ State: func(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { if err := d.Set("secret_name", d.Id()); err != nil { diff --git a/github/resource_github_codespaces_organization_secret_repositories.go b/github/resource_github_codespaces_organization_secret_repositories.go index 105b18c698..b21695d68d 100644 --- a/github/resource_github_codespaces_organization_secret_repositories.go +++ b/github/resource_github_codespaces_organization_secret_repositories.go @@ -9,10 +9,11 @@ import ( func resourceGithubCodespacesOrganizationSecretRepositories() *schema.Resource { return &schema.Resource{ - Create: resourceGithubCodespaceOrganizationSecretRepositoriesCreateOrUpdate, - Read: resourceGithubCodespaceOrganizationSecretRepositoriesRead, - Update: resourceGithubCodespaceOrganizationSecretRepositoriesCreateOrUpdate, - Delete: resourceGithubCodespaceOrganizationSecretRepositoriesDelete, + Description: "Manages the repository access list for an organization Codespaces secret.", + Create: resourceGithubCodespaceOrganizationSecretRepositoriesCreateOrUpdate, + Read: resourceGithubCodespaceOrganizationSecretRepositoriesRead, + Update: resourceGithubCodespaceOrganizationSecretRepositoriesCreateOrUpdate, + Delete: resourceGithubCodespaceOrganizationSecretRepositoriesDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_codespaces_organization_secret_repositories_test.go b/github/resource_github_codespaces_organization_secret_repositories_test.go index 9dae401bc5..cce61395cf 100644 --- a/github/resource_github_codespaces_organization_secret_repositories_test.go +++ b/github/resource_github_codespaces_organization_secret_repositories_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubCodespacesOrganizationSecretRepositories(t *testing.T) { t.Run("set repository allowlist for an organization secret", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName1 := fmt.Sprintf("%srepo-cs-org-secret-1-%s", testResourcePrefix, randomID) repoName2 := fmt.Sprintf("%srepo-cs-org-secret-2-%s", testResourcePrefix, randomID) diff --git a/github/resource_github_codespaces_secret.go b/github/resource_github_codespaces_secret.go index f11ab7ba18..091282950b 100644 --- a/github/resource_github_codespaces_secret.go +++ b/github/resource_github_codespaces_secret.go @@ -15,9 +15,10 @@ import ( func resourceGithubCodespacesSecret() *schema.Resource { return &schema.Resource{ - Create: resourceGithubCodespacesSecretCreateOrUpdate, - Read: resourceGithubCodespacesSecretRead, - Delete: resourceGithubCodespacesSecretDelete, + Description: "Manages a Codespaces secret within a repository.", + Create: resourceGithubCodespacesSecretCreateOrUpdate, + Read: resourceGithubCodespacesSecretRead, + Delete: resourceGithubCodespacesSecretDelete, Importer: &schema.ResourceImporter{ State: resourceGithubCodespacesSecretImport, }, diff --git a/github/resource_github_codespaces_secret_test.go b/github/resource_github_codespaces_secret_test.go index 46719ae9a7..7ba571796d 100644 --- a/github/resource_github_codespaces_secret_test.go +++ b/github/resource_github_codespaces_secret_test.go @@ -13,7 +13,7 @@ import ( func TestAccGithubCodespacesSecret(t *testing.T) { t.Run("reads a repository public key without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-codespaces-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -49,7 +49,7 @@ func TestAccGithubCodespacesSecret(t *testing.T) { }) t.Run("creates and updates secrets without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-codespaces-%s", testResourcePrefix, randomID) secretValue := base64.StdEncoding.EncodeToString([]byte("super_secret_value")) updatedSecretValue := base64.StdEncoding.EncodeToString([]byte("updated_super_secret_value")) @@ -126,7 +126,7 @@ func TestAccGithubCodespacesSecret(t *testing.T) { }) t.Run("creates and updates repository name without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-codespaces-%s", testResourcePrefix, randomID) updatedRepoName := fmt.Sprintf("%s-updated", repoName) secretValue := base64.StdEncoding.EncodeToString([]byte("super_secret_value")) @@ -209,7 +209,7 @@ func TestAccGithubCodespacesSecret(t *testing.T) { }) t.Run("deletes secrets without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-codespaces-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_codespaces_user_secret.go b/github/resource_github_codespaces_user_secret.go index 446ecc73d4..8f0f9f5008 100644 --- a/github/resource_github_codespaces_user_secret.go +++ b/github/resource_github_codespaces_user_secret.go @@ -14,9 +14,10 @@ import ( func resourceGithubCodespacesUserSecret() *schema.Resource { return &schema.Resource{ - Create: resourceGithubCodespacesUserSecretCreateOrUpdate, - Read: resourceGithubCodespacesUserSecretRead, - Delete: resourceGithubCodespacesUserSecretDelete, + Description: "Manages a Codespaces secret for a user.", + Create: resourceGithubCodespacesUserSecretCreateOrUpdate, + Read: resourceGithubCodespacesUserSecretRead, + Delete: resourceGithubCodespacesUserSecretDelete, Importer: &schema.ResourceImporter{ State: func(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { if err := d.Set("secret_name", d.Id()); err != nil { diff --git a/github/resource_github_dependabot_organization_secret.go b/github/resource_github_dependabot_organization_secret.go index ed48c986a8..6e810926e8 100644 --- a/github/resource_github_dependabot_organization_secret.go +++ b/github/resource_github_dependabot_organization_secret.go @@ -16,6 +16,7 @@ import ( func resourceGithubDependabotOrganizationSecret() *schema.Resource { return &schema.Resource{ + Description: "Manages a Dependabot secret within an organization.", Schema: map[string]*schema.Schema{ "secret_name": { Type: schema.TypeString, diff --git a/github/resource_github_dependabot_organization_secret_repositories.go b/github/resource_github_dependabot_organization_secret_repositories.go index 8c1ab3a3e6..a08d6fce30 100644 --- a/github/resource_github_dependabot_organization_secret_repositories.go +++ b/github/resource_github_dependabot_organization_secret_repositories.go @@ -10,6 +10,7 @@ import ( func resourceGithubDependabotOrganizationSecretRepositories() *schema.Resource { return &schema.Resource{ + Description: "Manages the repository access list for an organization Dependabot secret.", Schema: map[string]*schema.Schema{ "secret_name": { Type: schema.TypeString, diff --git a/github/resource_github_dependabot_organization_secret_repositories_test.go b/github/resource_github_dependabot_organization_secret_repositories_test.go index c3191d4c65..efa24f5c48 100644 --- a/github/resource_github_dependabot_organization_secret_repositories_test.go +++ b/github/resource_github_dependabot_organization_secret_repositories_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubDependabotOrganizationSecretRepositories(t *testing.T) { t.Run("create", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) secretName := fmt.Sprintf("test_%s", randomID) secretValue := base64.StdEncoding.EncodeToString([]byte("foo")) repoName0 := fmt.Sprintf("%s%s-0", testResourcePrefix, randomID) diff --git a/github/resource_github_dependabot_organization_secret_repository_test.go b/github/resource_github_dependabot_organization_secret_repository_test.go index 04771315bc..85f95bb0eb 100644 --- a/github/resource_github_dependabot_organization_secret_repository_test.go +++ b/github/resource_github_dependabot_organization_secret_repository_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubDependabotOrganizationSecretRepository(t *testing.T) { t.Run("create", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) secretName := fmt.Sprintf("test_%s", randomID) secretValue := base64.StdEncoding.EncodeToString([]byte("foo")) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) diff --git a/github/resource_github_dependabot_organization_secret_test.go b/github/resource_github_dependabot_organization_secret_test.go index 733c6150d2..af835eb856 100644 --- a/github/resource_github_dependabot_organization_secret_test.go +++ b/github/resource_github_dependabot_organization_secret_test.go @@ -258,8 +258,8 @@ resource "github_dependabot_organization_secret" "test" { }) t.Run("create_update_visibility_selected", func(t *testing.T) { - repoName0 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)) - repoName1 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)) + repoName0 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandString(5)) + repoName1 := fmt.Sprintf("%s%s", testResourcePrefix, acctest.RandString(5)) randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlpha) secretName := fmt.Sprintf("test_%s", randomID) value := base64.StdEncoding.EncodeToString([]byte("foo")) diff --git a/github/resource_github_dependabot_secret.go b/github/resource_github_dependabot_secret.go index d51e7fccef..87196e91f5 100644 --- a/github/resource_github_dependabot_secret.go +++ b/github/resource_github_dependabot_secret.go @@ -15,6 +15,7 @@ import ( func resourceGithubDependabotSecret() *schema.Resource { return &schema.Resource{ + Description: "Manages a Dependabot secret within a repository.", SchemaVersion: 1, StateUpgraders: []schema.StateUpgrader{ { diff --git a/github/resource_github_dependabot_secret_test.go b/github/resource_github_dependabot_secret_test.go index cc6e66c363..8947d908aa 100644 --- a/github/resource_github_dependabot_secret_test.go +++ b/github/resource_github_dependabot_secret_test.go @@ -15,7 +15,7 @@ import ( func TestAccGithubDependabotSecret(t *testing.T) { t.Run("create_plaintext", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" value := base64.StdEncoding.EncodeToString([]byte("super_secret_value")) @@ -53,7 +53,7 @@ resource "github_dependabot_secret" "test" { }) t.Run("create_update_plaintext", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" value := base64.StdEncoding.EncodeToString([]byte("super_secret_value")) @@ -104,7 +104,7 @@ resource "github_dependabot_secret" "test" { }) t.Run("create_update_encrypted", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" value := base64.StdEncoding.EncodeToString([]byte("super_secret_value")) @@ -155,7 +155,7 @@ resource "github_dependabot_secret" "test" { }) t.Run("create_update_encrypted_with_key", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" value := base64.StdEncoding.EncodeToString([]byte("super_secret_value")) @@ -211,7 +211,7 @@ resource "github_dependabot_secret" "test" { }) t.Run("update_on_drift", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" @@ -288,7 +288,7 @@ resource "github_dependabot_secret" "test" { }) t.Run("lifecycle_can_ignore_drift", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" @@ -369,7 +369,7 @@ resource "github_dependabot_secret" "test" { }) t.Run("update_renamed_repo", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) updatedRepoName := fmt.Sprintf("%s%s-updated", testResourcePrefix, randomID) @@ -421,7 +421,7 @@ resource "github_dependabot_secret" "test" { }) t.Run("recreate_changed_repo", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) repoName2 := fmt.Sprintf("%supdated-%s", testResourcePrefix, randomID) @@ -493,7 +493,7 @@ resource "github_dependabot_secret" "test" { }) t.Run("destroy", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -524,7 +524,7 @@ resource "github_dependabot_secret" "test" { }) t.Run("import", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) secretName := "test" diff --git a/github/resource_github_emu_group_mapping.go b/github/resource_github_emu_group_mapping.go index 244ea3348a..099b1cca60 100644 --- a/github/resource_github_emu_group_mapping.go +++ b/github/resource_github_emu_group_mapping.go @@ -45,8 +45,9 @@ func resourceGithubEMUGroupMapping() *schema.Resource { Description: "Name of the external group.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the EMU group mapping.", }, }, SchemaVersion: 1, diff --git a/github/resource_github_emu_group_mapping_migration.go b/github/resource_github_emu_group_mapping_migration.go index f6aa87fb47..3ff349cd1f 100644 --- a/github/resource_github_emu_group_mapping_migration.go +++ b/github/resource_github_emu_group_mapping_migration.go @@ -22,6 +22,7 @@ func resourceGithubEMUGroupMappingV0() *schema.Resource { Required: true, Description: "Integer corresponding to the external group ID to be linked.", }, + // lintignore:XS001 // No changes to old schema versions "etag": { Type: schema.TypeString, Computed: true, diff --git a/github/resource_github_emu_group_mapping_test.go b/github/resource_github_emu_group_mapping_test.go index aeee3f8e32..1bcc9fcec0 100644 --- a/github/resource_github_emu_group_mapping_test.go +++ b/github/resource_github_emu_group_mapping_test.go @@ -17,7 +17,7 @@ func TestAccGithubEMUGroupMapping(t *testing.T) { t.Skip("Skipping EMU group mapping tests because testEnterpriseEMUGroupId is not set") } t.Run("creates and manages EMU group mapping", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-emu-%s", testResourcePrefix, randomID) resource.Test(t, resource.TestCase{ @@ -38,7 +38,7 @@ func TestAccGithubEMUGroupMapping(t *testing.T) { }) t.Run("imports EMU group mapping", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-emu-%s", testResourcePrefix, randomID) rn := "github_emu_group_mapping.test" @@ -60,7 +60,7 @@ func TestAccGithubEMUGroupMapping(t *testing.T) { }) }) t.Run("imports EMU group mapping with multiple teams", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam1-emu-%s", testResourcePrefix, randomID) teamName2 := fmt.Sprintf("%steam2-emu-%s", testResourcePrefix, randomID) rn := "github_emu_group_mapping.test1" @@ -102,7 +102,7 @@ func TestAccGithubEMUGroupMapping(t *testing.T) { }) t.Run("handles team slug update by recreating", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName1 := fmt.Sprintf("%steam-emu-%s", testResourcePrefix, randomID) teamName2 := fmt.Sprintf("%s-upd", teamName1) diff --git a/github/resource_github_enterprise_actions_permissions.go b/github/resource_github_enterprise_actions_permissions.go index f5470afa65..cad734aaea 100644 --- a/github/resource_github_enterprise_actions_permissions.go +++ b/github/resource_github_enterprise_actions_permissions.go @@ -11,10 +11,11 @@ import ( func resourceGithubActionsEnterprisePermissions() *schema.Resource { return &schema.Resource{ - Create: resourceGithubActionsEnterprisePermissionsCreateOrUpdate, - Read: resourceGithubActionsEnterprisePermissionsRead, - Update: resourceGithubActionsEnterprisePermissionsCreateOrUpdate, - Delete: resourceGithubActionsEnterprisePermissionsDelete, + Description: "Manages GitHub Actions permissions for an enterprise.", + Create: resourceGithubActionsEnterprisePermissionsCreateOrUpdate, + Read: resourceGithubActionsEnterprisePermissionsRead, + Update: resourceGithubActionsEnterprisePermissionsCreateOrUpdate, + Delete: resourceGithubActionsEnterprisePermissionsDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_enterprise_actions_permissions_test.go b/github/resource_github_enterprise_actions_permissions_test.go index 4511865293..407286848c 100644 --- a/github/resource_github_enterprise_actions_permissions_test.go +++ b/github/resource_github_enterprise_actions_permissions_test.go @@ -47,7 +47,7 @@ func TestAccGithubActionsEnterprisePermissions(t *testing.T) { enabledOrganizations := "selected" githubOwnedAllowed := true verifiedAllowed := true - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) orgName := fmt.Sprintf("tf-acc-test-displayname%s", randomID) displayName := fmt.Sprintf("Tf Acc Test displayname %s", randomID) @@ -163,8 +163,8 @@ func TestAccGithubActionsEnterprisePermissions(t *testing.T) { t.Run("test setting of enterprise enabled organizations", func(t *testing.T) { allowedActions := "all" enabledOrganizations := "selected" - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) - randomID2 := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) + randomID2 := acctest.RandString(5) orgName := fmt.Sprintf("tf-acc-test-displayname%s", randomID) orgName2 := fmt.Sprintf("tf-acc-test-displayname%s", randomID2) diff --git a/github/resource_github_enterprise_actions_runner_group.go b/github/resource_github_enterprise_actions_runner_group.go index c37ebd8bef..f77e47d992 100644 --- a/github/resource_github_enterprise_actions_runner_group.go +++ b/github/resource_github_enterprise_actions_runner_group.go @@ -16,10 +16,11 @@ import ( func resourceGithubActionsEnterpriseRunnerGroup() *schema.Resource { return &schema.Resource{ - Create: resourceGithubActionsEnterpriseRunnerGroupCreate, - Read: resourceGithubActionsEnterpriseRunnerGroupRead, - Update: resourceGithubActionsEnterpriseRunnerGroupUpdate, - Delete: resourceGithubActionsEnterpriseRunnerGroupDelete, + Description: "Manages a GitHub Actions runner group within an enterprise.", + Create: resourceGithubActionsEnterpriseRunnerGroupCreate, + Read: resourceGithubActionsEnterpriseRunnerGroupRead, + Update: resourceGithubActionsEnterpriseRunnerGroupUpdate, + Delete: resourceGithubActionsEnterpriseRunnerGroupDelete, Importer: &schema.ResourceImporter{ State: resourceGithubActionsEnterpriseRunnerGroupImport, }, diff --git a/github/resource_github_enterprise_actions_runner_group_test.go b/github/resource_github_enterprise_actions_runner_group_test.go index fec43eb55d..dbe49e5a57 100644 --- a/github/resource_github_enterprise_actions_runner_group_test.go +++ b/github/resource_github_enterprise_actions_runner_group_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubActionsEnterpriseRunnerGroup(t *testing.T) { t.Run("creates enterprise runner groups without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` data "github_enterprise" "enterprise" { slug = "%s" @@ -56,7 +56,7 @@ func TestAccGithubActionsEnterpriseRunnerGroup(t *testing.T) { }) t.Run("manages runner group visibility to selected orgs", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` data "github_enterprise" "enterprise" { slug = "%s" @@ -108,7 +108,7 @@ func TestAccGithubActionsEnterpriseRunnerGroup(t *testing.T) { }) t.Run("imports an all runner group without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` data "github_enterprise" "enterprise" { slug = "%s" @@ -147,7 +147,7 @@ func TestAccGithubActionsEnterpriseRunnerGroup(t *testing.T) { }) t.Run("imports a runner group with selected orgs without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` data "github_enterprise" "enterprise" { slug = "%s" diff --git a/github/resource_github_enterprise_organization.go b/github/resource_github_enterprise_organization.go index 3400c54663..325474ab20 100644 --- a/github/resource_github_enterprise_organization.go +++ b/github/resource_github_enterprise_organization.go @@ -27,10 +27,11 @@ func isSAMLEnforcementError(err error) bool { func resourceGithubEnterpriseOrganization() *schema.Resource { return &schema.Resource{ - Create: resourceGithubEnterpriseOrganizationCreate, - Read: resourceGithubEnterpriseOrganizationRead, - Delete: resourceGithubEnterpriseOrganizationDelete, - Update: resourceGithubEnterpriseOrganizationUpdate, + Description: "Manages an organization within a GitHub Enterprise.", + Create: resourceGithubEnterpriseOrganizationCreate, + Read: resourceGithubEnterpriseOrganizationRead, + Delete: resourceGithubEnterpriseOrganizationDelete, + Update: resourceGithubEnterpriseOrganizationUpdate, Importer: &schema.ResourceImporter{ State: resourceGithubEnterpriseOrganizationImport, }, diff --git a/github/resource_github_enterprise_organization_test.go b/github/resource_github_enterprise_organization_test.go index 94e7b33040..73babefade 100644 --- a/github/resource_github_enterprise_organization_test.go +++ b/github/resource_github_enterprise_organization_test.go @@ -72,7 +72,7 @@ func TestIsSAMLEnforcementError(t *testing.T) { func TestAccGithubEnterpriseOrganization(t *testing.T) { t.Run("creates and updates an enterprise organization without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) orgName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) desc := "Initial org description" @@ -146,7 +146,7 @@ func TestAccGithubEnterpriseOrganization(t *testing.T) { }) t.Run("deletes an enterprise organization without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) orgName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -181,7 +181,7 @@ func TestAccGithubEnterpriseOrganization(t *testing.T) { }) t.Run("creates and updates org with display name", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) orgName := fmt.Sprintf("tf-acc-test-displayname%s", randomID) displayName := fmt.Sprintf("Tf Acc Test displayname %s", randomID) @@ -270,7 +270,7 @@ func TestAccGithubEnterpriseOrganization(t *testing.T) { }) t.Run("creates org without display name, set and update display name", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) orgName := fmt.Sprintf("tf-acc-test-adddisplayname%s", randomID) displayName := fmt.Sprintf("Tf Acc Test Add displayname %s", randomID) @@ -415,7 +415,7 @@ func TestAccGithubEnterpriseOrganization(t *testing.T) { }) t.Run("imports enterprise organization without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) orgName := fmt.Sprintf("tf-acc-test-import%s", randomID) config := fmt.Sprintf(` @@ -458,7 +458,7 @@ func TestAccGithubEnterpriseOrganization(t *testing.T) { }) t.Run("imports enterprise organization invalid enterprise name", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) orgName := fmt.Sprintf("tf-acc-test-adddisplayname%s", randomID) config := fmt.Sprintf(` @@ -502,7 +502,7 @@ func TestAccGithubEnterpriseOrganization(t *testing.T) { }) t.Run("imports enterprise organization invalid organization name", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) orgName := fmt.Sprintf("tf-acc-test-adddisplayname%s", randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_etag_acc_test.go b/github/resource_github_etag_acc_test.go index 0cb16fe4e0..cdfbdfe0c6 100644 --- a/github/resource_github_etag_acc_test.go +++ b/github/resource_github_etag_acc_test.go @@ -10,7 +10,7 @@ import ( // TestAccGithubRepositoryEtagPresent tests that etag field is populated. func TestAccGithubRepositoryEtagPresent(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-etag-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -37,7 +37,7 @@ func TestAccGithubRepositoryEtagPresent(t *testing.T) { // TestAccGithubRepositoryEtagNoDiff tests that re-running the same config shows no changes. func TestAccGithubRepositoryEtagNoDiff(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-etag-nodiff-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_etag_unit_test.go b/github/resource_github_etag_unit_test.go index 267f40f485..d464859b01 100644 --- a/github/resource_github_etag_unit_test.go +++ b/github/resource_github_etag_unit_test.go @@ -14,7 +14,7 @@ func TestEtagDiffSuppressFunction(t *testing.T) { if etagField == nil { t.Fatal("etag field not found in repository schema") - panic("unreachable") // This resolves https://github.com/golangci/golangci-lint/issues/5979 + panic("unreachable") // lintignore:R009 // This resolves https://github.com/golangci/golangci-lint/issues/5979 } if etagField.DiffSuppressFunc == nil { diff --git a/github/resource_github_issue.go b/github/resource_github_issue.go index 3588c81c6d..705d98321d 100644 --- a/github/resource_github_issue.go +++ b/github/resource_github_issue.go @@ -13,10 +13,11 @@ import ( func resourceGithubIssue() *schema.Resource { return &schema.Resource{ - Create: resourceGithubIssueCreateOrUpdate, - Read: resourceGithubIssueRead, - Update: resourceGithubIssueCreateOrUpdate, - Delete: resourceGithubIssueDelete, + Description: "Manages a GitHub issue within a repository.", + Create: resourceGithubIssueCreateOrUpdate, + Read: resourceGithubIssueRead, + Update: resourceGithubIssueCreateOrUpdate, + Delete: resourceGithubIssueDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -29,7 +30,6 @@ func resourceGithubIssue() *schema.Resource { }, "number": { Type: schema.TypeInt, - Required: false, Computed: true, Description: "The issue number.", }, @@ -68,8 +68,9 @@ func resourceGithubIssue() *schema.Resource { Description: "The issue id.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the issue.", }, }, } diff --git a/github/resource_github_issue_label.go b/github/resource_github_issue_label.go index adaefc8c8e..1cc360df6c 100644 --- a/github/resource_github_issue_label.go +++ b/github/resource_github_issue_label.go @@ -12,10 +12,11 @@ import ( func resourceGithubIssueLabel() *schema.Resource { return &schema.Resource{ - Create: resourceGithubIssueLabelCreateOrUpdate, - Read: resourceGithubIssueLabelRead, - Update: resourceGithubIssueLabelCreateOrUpdate, - Delete: resourceGithubIssueLabelDelete, + Description: "Manages a single label within a repository.", + Create: resourceGithubIssueLabelCreateOrUpdate, + Read: resourceGithubIssueLabelRead, + Update: resourceGithubIssueLabelCreateOrUpdate, + Delete: resourceGithubIssueLabelDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -48,9 +49,10 @@ func resourceGithubIssueLabel() *schema.Resource { Description: "The URL to the issue label.", }, "etag": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "An etag representing the issue label.", DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool { return true }, diff --git a/github/resource_github_issue_label_test.go b/github/resource_github_issue_label_test.go index 7bf1178aa3..a4bbb6239c 100644 --- a/github/resource_github_issue_label_test.go +++ b/github/resource_github_issue_label_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubIssueLabel(t *testing.T) { t.Run("creates and updates labels without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-issue-label-%s", testResourcePrefix, randomID) description := "label_description" updatedDescription := "updated_label_description" @@ -65,7 +65,7 @@ func TestAccGithubIssueLabel(t *testing.T) { }) t.Run("can delete labels from archived repositories without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-issue-label-arch-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_issue_labels.go b/github/resource_github_issue_labels.go index 971d97c000..3ce4590d40 100644 --- a/github/resource_github_issue_labels.go +++ b/github/resource_github_issue_labels.go @@ -11,10 +11,11 @@ import ( func resourceGithubIssueLabels() *schema.Resource { return &schema.Resource{ - Create: resourceGithubIssueLabelsCreateOrUpdate, - Read: resourceGithubIssueLabelsRead, - Update: resourceGithubIssueLabelsCreateOrUpdate, - Delete: resourceGithubIssueLabelsDelete, + Description: "Manages the complete set of labels for a repository.", + Create: resourceGithubIssueLabelsCreateOrUpdate, + Read: resourceGithubIssueLabelsRead, + Update: resourceGithubIssueLabelsCreateOrUpdate, + Delete: resourceGithubIssueLabelsDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_issue_labels_test.go b/github/resource_github_issue_labels_test.go index 9465eb0d68..d643991def 100644 --- a/github/resource_github_issue_labels_test.go +++ b/github/resource_github_issue_labels_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubIssueLabels(t *testing.T) { t.Run("authoritatively overtakes existing labels", func(t *testing.T) { - repoName := fmt.Sprintf("%srepo-issue-labels-%s", testResourcePrefix, acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)) + repoName := fmt.Sprintf("%srepo-issue-labels-%s", testResourcePrefix, acctest.RandString(5)) empty := []map[string]any{} resource.Test(t, resource.TestCase{ @@ -114,7 +114,7 @@ func testAccGithubIssueLabelsConfig(repoName string, labels []map[string]any) st } func TestAccGithubIssueLabelsArchived(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) t.Run("can delete labels from archived repositories without error", func(t *testing.T) { repoName := fmt.Sprintf("%srepo-labels-arch-%s", testResourcePrefix, randomID) diff --git a/github/resource_github_issue_test.go b/github/resource_github_issue_test.go index 57d830d839..f148713e07 100644 --- a/github/resource_github_issue_test.go +++ b/github/resource_github_issue_test.go @@ -12,7 +12,7 @@ import ( func TestAccGithubIssue(t *testing.T) { t.Run("creates an issue without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-issue-%s", testResourcePrefix, randomID) title := "issue_title" body := "issue_body" @@ -110,7 +110,7 @@ func TestAccGithubIssue(t *testing.T) { }) t.Run("imports a issue without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-issue-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_membership.go b/github/resource_github_membership.go index d1ddfacab2..6507418f7e 100644 --- a/github/resource_github_membership.go +++ b/github/resource_github_membership.go @@ -38,8 +38,9 @@ func resourceGithubMembership() *schema.Resource { Description: "The role of the user within the organization. Must be one of 'member' or 'admin'.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the membership.", }, "downgrade_on_destroy": { Type: schema.TypeBool, diff --git a/github/resource_github_organization_custom_properties.go b/github/resource_github_organization_custom_properties.go index ec8872ee36..d38be620f2 100644 --- a/github/resource_github_organization_custom_properties.go +++ b/github/resource_github_organization_custom_properties.go @@ -11,10 +11,11 @@ import ( func resourceGithubOrganizationCustomProperties() *schema.Resource { return &schema.Resource{ - Create: resourceGithubCustomPropertiesCreate, - Read: resourceGithubCustomPropertiesRead, - Update: resourceGithubCustomPropertiesUpdate, - Delete: resourceGithubCustomPropertiesDelete, + Description: "Manages a custom property for an organization.", + Create: resourceGithubCustomPropertiesCreate, + Read: resourceGithubCustomPropertiesRead, + Update: resourceGithubCustomPropertiesUpdate, + Delete: resourceGithubCustomPropertiesDelete, Importer: &schema.ResourceImporter{ State: resourceGithubCustomPropertiesImport, }, diff --git a/github/resource_github_organization_custom_role.go b/github/resource_github_organization_custom_role.go index 1d4727cd4a..6e48cfe571 100644 --- a/github/resource_github_organization_custom_role.go +++ b/github/resource_github_organization_custom_role.go @@ -12,6 +12,7 @@ import ( func resourceGithubOrganizationCustomRole() *schema.Resource { return &schema.Resource{ + Description: "Manages a custom role for an organization.", DeprecationMessage: "This resource is deprecated and will be removed in a future release. Use github_organization_repository_role resource instead.", Create: resourceGithubOrganizationCustomRoleCreate, diff --git a/github/resource_github_organization_custom_role_test.go b/github/resource_github_organization_custom_role_test.go index 15a8284a0e..2de1ba4383 100644 --- a/github/resource_github_organization_custom_role_test.go +++ b/github/resource_github_organization_custom_role_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubOrganizationCustomRole(t *testing.T) { t.Run("creates custom repo role without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_organization_custom_role" "test" { name = "tf-acc-test-%s" @@ -43,7 +43,7 @@ func TestAccGithubOrganizationCustomRole(t *testing.T) { // More tests can go here following the same format... t.Run("updates custom repo role without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_organization_custom_role" "test" { name = "tf-acc-test-%s" @@ -98,7 +98,7 @@ func TestAccGithubOrganizationCustomRole(t *testing.T) { }) t.Run("imports custom repo role without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_organization_custom_role" "test" { name = "tf-acc-test-%s" diff --git a/github/resource_github_organization_project.go b/github/resource_github_organization_project.go index 005bc0a181..da914d7fd7 100644 --- a/github/resource_github_organization_project.go +++ b/github/resource_github_organization_project.go @@ -8,6 +8,7 @@ import ( func resourceGithubOrganizationProject() *schema.Resource { return &schema.Resource{ + Description: "Manages a classic project within an organization.", DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.", Create: resourceGithubOrganizationProjectCreate, @@ -35,8 +36,9 @@ func resourceGithubOrganizationProject() *schema.Resource { Description: "URL of the project.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the project.", }, }, } diff --git a/github/resource_github_organization_repository_role_test.go b/github/resource_github_organization_repository_role_test.go index 72116c55a3..88ef0f139b 100644 --- a/github/resource_github_organization_repository_role_test.go +++ b/github/resource_github_organization_repository_role_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubOrganizationRepositoryRole(t *testing.T) { t.Run("can create an organization repository role without erroring", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) name := fmt.Sprintf("tf-acc-org-repo-role-%s", randomID) description := "This is a test org repo role." baseRole := "write" @@ -52,7 +52,7 @@ func TestAccGithubOrganizationRepositoryRole(t *testing.T) { }) t.Run("can create an minimal organization repository role without erroring", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) name := fmt.Sprintf("tf-acc-org-repo-role-%s", randomID) permission0 := "reopen_issue" diff --git a/github/resource_github_organization_role_team_assignment.go b/github/resource_github_organization_role_team_assignment.go index 8c513e6dc5..5b4e02c289 100644 --- a/github/resource_github_organization_role_team_assignment.go +++ b/github/resource_github_organization_role_team_assignment.go @@ -11,6 +11,7 @@ import ( func resourceGithubOrganizationRoleTeamAssignment() *schema.Resource { return &schema.Resource{ + Description: "Manages the assignment of a team to an organization role.", DeprecationMessage: "This resource is deprecated in favor of the github_organization_role_team resource.", Create: resourceGithubOrganizationRoleTeamAssignmentCreate, diff --git a/github/resource_github_organization_role_team_assignment_test.go b/github/resource_github_organization_role_team_assignment_test.go index 9465c34084..31e2bff21e 100644 --- a/github/resource_github_organization_role_team_assignment_test.go +++ b/github/resource_github_organization_role_team_assignment_test.go @@ -18,7 +18,7 @@ func TestAccGithubOrganizationRoleTeamAssignment(t *testing.T) { githubPredefinedRoleMapping["all_repo_admin"] = "8136" t.Run("creates repo assignment without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamSlug := fmt.Sprintf("%steam-role-assign-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -58,7 +58,7 @@ func TestAccGithubOrganizationRoleTeamAssignment(t *testing.T) { // More tests can go here following the same format... t.Run("create and re-creates role assignment without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamSlug := fmt.Sprintf("%steam-role-assign-%s", testResourcePrefix, randomID) configs := map[string]string{ diff --git a/github/resource_github_organization_role_team_test.go b/github/resource_github_organization_role_team_test.go index 5c1f7e6897..9492ef649d 100644 --- a/github/resource_github_organization_role_team_test.go +++ b/github/resource_github_organization_role_team_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubOrganizationRoleTeam(t *testing.T) { t.Run("adds team to an organization org role", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-org-role-%s", testResourcePrefix, randomID) roleId := 8134 config := fmt.Sprintf(` diff --git a/github/resource_github_organization_role_test.go b/github/resource_github_organization_role_test.go index efc3c28b98..5e86897513 100644 --- a/github/resource_github_organization_role_test.go +++ b/github/resource_github_organization_role_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubOrganizationRole(t *testing.T) { t.Run("can create an empty organization role", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) name := fmt.Sprintf("tf-acc-org-role-%s", randomID) config := fmt.Sprintf(` resource "github_organization_role" "test" { @@ -39,7 +39,7 @@ func TestAccGithubOrganizationRole(t *testing.T) { }) t.Run("can create an empty organization role with a base role", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) name := fmt.Sprintf("tf-acc-org-role-%s", randomID) baseRole := "read" @@ -70,7 +70,7 @@ func TestAccGithubOrganizationRole(t *testing.T) { }) t.Run("can create an organization role", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) name := fmt.Sprintf("tf-acc-org-role-%s", randomID) baseRole := "none" permission0 := "read_organization_actions_usage_metrics" @@ -105,7 +105,7 @@ func TestAccGithubOrganizationRole(t *testing.T) { }) t.Run("can create an organization role with repo permissions", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) name := fmt.Sprintf("tf-acc-org-role-%s", randomID) description := "This is a test org role." baseRole := "write" @@ -143,7 +143,7 @@ func TestAccGithubOrganizationRole(t *testing.T) { }) t.Run("can create an organization role with org and repo permissions", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) name := fmt.Sprintf("tf-acc-org-role-%s", randomID) description := "This is a test org role." baseRole := "write" diff --git a/github/resource_github_organization_ruleset.go b/github/resource_github_organization_ruleset.go index 8624250883..45dfec55ab 100644 --- a/github/resource_github_organization_ruleset.go +++ b/github/resource_github_organization_ruleset.go @@ -784,6 +784,7 @@ func resourceGithubOrganizationRulesetRead(ctx context.Context, d *schema.Resour if err := d.Set("name", ruleset.Name); err != nil { return diag.FromErr(err) } + // lintignore:R004 // `github.RulesetTarget` is a string if err := d.Set("target", ruleset.GetTarget()); err != nil { return diag.FromErr(err) } diff --git a/github/resource_github_organization_ruleset_test.go b/github/resource_github_organization_ruleset_test.go index 6f8dd502c5..1b615d13e6 100644 --- a/github/resource_github_organization_ruleset_test.go +++ b/github/resource_github_organization_ruleset_test.go @@ -12,7 +12,7 @@ import ( func TestAccGithubOrganizationRuleset(t *testing.T) { t.Run("create_branch_ruleset", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-org-ruleset-%s", testResourcePrefix, randomID) rulesetName := fmt.Sprintf("%s-branch-ruleset-%s", testResourcePrefix, randomID) @@ -183,7 +183,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("create_push_ruleset", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) rulesetName := fmt.Sprintf("%s-push-ruleset-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -261,7 +261,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("update_ruleset_name", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) name := fmt.Sprintf("test-acc-ruleset-%s", randomID) nameUpdated := fmt.Sprintf("test-acc-ruleset-updated-%s", randomID) @@ -310,7 +310,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("update_clear_bypass_actors", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) rulesetName := fmt.Sprintf("%s-bypass-ruleset-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -399,7 +399,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("update_bypass_mode", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) bypassMode := "always" bypassModeUpdated := "exempt" @@ -456,7 +456,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("import", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_organization_ruleset" "test" { @@ -500,7 +500,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("validates_branch_target_requires_ref_name_condition", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_organization_ruleset" "test" { name = "test-validation-%s" @@ -533,7 +533,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("validates_tag_target_requires_ref_name_condition", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_organization_ruleset" "test" { name = "test-tag-no-conditions-%s" @@ -566,7 +566,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("validates_push_target_rejects_ref_name_condition", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) resourceName := "test-push-reject-ref-name" config := fmt.Sprintf(` resource "github_organization_ruleset" "%s" { @@ -607,7 +607,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("validates_push_target_rejects_branch_or_tag_rules", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) resourceName := "test-push-reject-branch-rules" config := fmt.Sprintf(` resource "github_organization_ruleset" "%s" { @@ -642,7 +642,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("validates_branch_target_rejects_push-only_rules", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) resourceName := "test-branch-reject-push-rules" config := fmt.Sprintf(` resource "github_organization_ruleset" "%s" { @@ -683,7 +683,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("creates_push_ruleset", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) rulesetName := fmt.Sprintf("%stest-push-%s", testResourcePrefix, randomID) resourceName := "test-push-ruleset" resourceFullName := fmt.Sprintf("github_organization_ruleset.%s", resourceName) @@ -811,7 +811,7 @@ resource "github_organization_ruleset" "test" { }) t.Run("updates_required_reviewers", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-req-rev-%s", testResourcePrefix, randomID) rulesetName := fmt.Sprintf("%s-ruleset-req-rev-%s", testResourcePrefix, randomID) @@ -889,7 +889,7 @@ resource "github_organization_ruleset" "test" { }) }) t.Run("creates_rule_with_multiple_required_reviewers", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName1 := fmt.Sprintf("%steam-req-rev-1-%s", testResourcePrefix, randomID) teamName2 := fmt.Sprintf("%steam-req-rev-2-%s", testResourcePrefix, randomID) rulesetName := fmt.Sprintf("%s-ruleset-multi-rev-%s", testResourcePrefix, randomID) diff --git a/github/resource_github_organization_security_manager.go b/github/resource_github_organization_security_manager.go index 5503619102..76830366bd 100644 --- a/github/resource_github_organization_security_manager.go +++ b/github/resource_github_organization_security_manager.go @@ -12,6 +12,7 @@ import ( func resourceGithubOrganizationSecurityManager() *schema.Resource { return &schema.Resource{ + Description: "Manages the security manager role for a team in an organization.", DeprecationMessage: "This resource is deprecated in favor of the github_organization_role_team resource.", Create: resourceGithubOrganizationSecurityManagerCreate, diff --git a/github/resource_github_organization_security_manager_test.go b/github/resource_github_organization_security_manager_test.go index e65286274a..1c36dc7a5a 100644 --- a/github/resource_github_organization_security_manager_test.go +++ b/github/resource_github_organization_security_manager_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubOrganizationSecurityManager(t *testing.T) { t.Run("adds team as security manager", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-sec-mgr-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { @@ -39,7 +39,7 @@ func TestAccGithubOrganizationSecurityManager(t *testing.T) { }) t.Run("handles team name changes", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-sec-mgr-%s", testResourcePrefix, randomID) teamNameUpdated := fmt.Sprintf("%s-updated", teamName) config := fmt.Sprintf(` diff --git a/github/resource_github_organization_settings.go b/github/resource_github_organization_settings.go index c5ae0bd5b4..afd154dea7 100644 --- a/github/resource_github_organization_settings.go +++ b/github/resource_github_organization_settings.go @@ -13,10 +13,11 @@ import ( func resourceGithubOrganizationSettings() *schema.Resource { return &schema.Resource{ - Create: resourceGithubOrganizationSettingsCreateOrUpdate, - Read: resourceGithubOrganizationSettingsRead, - Update: resourceGithubOrganizationSettingsCreateOrUpdate, - Delete: resourceGithubOrganizationSettingsDelete, + Description: "Manages settings for an organization.", + Create: resourceGithubOrganizationSettingsCreateOrUpdate, + Read: resourceGithubOrganizationSettingsRead, + Update: resourceGithubOrganizationSettingsCreateOrUpdate, + Delete: resourceGithubOrganizationSettingsDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_organization_webhook.go b/github/resource_github_organization_webhook.go index 62c9a8926f..bb8f898b7c 100644 --- a/github/resource_github_organization_webhook.go +++ b/github/resource_github_organization_webhook.go @@ -52,8 +52,9 @@ func resourceGithubOrganizationWebhook() *schema.Resource { Description: "Indicate if the webhook should receive events.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the webhook.", }, }, } diff --git a/github/resource_github_organization_webhook_migration.go b/github/resource_github_organization_webhook_migration.go index b7d86e55a7..28c1ca6472 100644 --- a/github/resource_github_organization_webhook_migration.go +++ b/github/resource_github_organization_webhook_migration.go @@ -12,28 +12,34 @@ func resourceGithubOrganizationWebhookResourceV0() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The type of the webhook.", }, "events": { - Type: schema.TypeSet, - Required: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Type: schema.TypeSet, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "A list of events which should trigger the webhook.", }, "configuration": { - Type: schema.TypeMap, - Optional: true, + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Webhook configuration options.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL of the webhook.", }, "active": { - Type: schema.TypeBool, - Optional: true, - Default: true, + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Indicate if the webhook should receive events.", }, }, } diff --git a/github/resource_github_organization_webhook_test.go b/github/resource_github_organization_webhook_test.go index d3ceed7e40..b67e60e120 100644 --- a/github/resource_github_organization_webhook_test.go +++ b/github/resource_github_organization_webhook_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubOrganizationWebhook(t *testing.T) { t.Run("creates and updates webhooks without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-org-webhook-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -66,7 +66,7 @@ func TestAccGithubOrganizationWebhook(t *testing.T) { }) t.Run("imports webhooks without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-org-webhook-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_project_card.go b/github/resource_github_project_card.go index 5e746dbe50..7f236f6531 100644 --- a/github/resource_github_project_card.go +++ b/github/resource_github_project_card.go @@ -8,6 +8,7 @@ import ( func resourceGithubProjectCard() *schema.Resource { return &schema.Resource{ + Description: "Manages a card in a classic project.", DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.", Create: resourceGithubProjectCardCreate, @@ -40,8 +41,9 @@ func resourceGithubProjectCard() *schema.Resource { Description: "Must be either 'Issue' or 'PullRequest'.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the project card.", }, "card_id": { Type: schema.TypeInt, diff --git a/github/resource_github_project_card_test.go b/github/resource_github_project_card_test.go index ee5c808b07..cb5d05dce3 100644 --- a/github/resource_github_project_card_test.go +++ b/github/resource_github_project_card_test.go @@ -14,7 +14,7 @@ func TestAccGithubProjectCard(t *testing.T) { t.Skip("Skipping test as the GitHub API no longer supports classic projects") t.Run("creates a project card using a note", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testResourceName := fmt.Sprintf("%sproject-card-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -54,7 +54,7 @@ func TestAccGithubProjectCard(t *testing.T) { }) t.Run("creates a project card using an issue", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-project-card-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_project_column.go b/github/resource_github_project_column.go index 830a6bb349..92acbd683b 100644 --- a/github/resource_github_project_column.go +++ b/github/resource_github_project_column.go @@ -8,6 +8,7 @@ import ( func resourceGithubProjectColumn() *schema.Resource { return &schema.Resource{ + Description: "Manages a column in a classic project.", DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.", Create: resourceGithubProjectColumnCreate, @@ -36,8 +37,9 @@ func resourceGithubProjectColumn() *schema.Resource { Description: "The ID of the column.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the project column.", }, }, } diff --git a/github/resource_github_release.go b/github/resource_github_release.go index 98949c9cd0..c32ca185ae 100644 --- a/github/resource_github_release.go +++ b/github/resource_github_release.go @@ -81,8 +81,9 @@ func resourceGithubRelease() *schema.Resource { Description: "If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the release.", }, "release_id": { Type: schema.TypeInt, @@ -273,7 +274,7 @@ func resourceGithubReleaseImport(d *schema.ResourceData, meta any) ([]*schema.Re if repository == nil || err != nil { return []*schema.ResourceData{d}, err } - if err = d.Set("repository", *repository.Name); err != nil { + if err = d.Set("repository", repository.Name); err != nil { return []*schema.ResourceData{d}, err } diff --git a/github/resource_github_release_test.go b/github/resource_github_release_test.go index 70d2b409aa..c23766d156 100644 --- a/github/resource_github_release_test.go +++ b/github/resource_github_release_test.go @@ -13,7 +13,7 @@ import ( func TestAccGithubReleaseResource(t *testing.T) { t.Run("create a release with defaults", func(t *testing.T) { - randomRepoPart := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomRepoPart := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-release-%s", testResourcePrefix, randomRepoPart) randomVersion := fmt.Sprintf("v1.0.%d", acctest.RandIntRange(0, 9999)) @@ -76,7 +76,7 @@ func TestAccGithubReleaseResource(t *testing.T) { }) t.Run("create a release on branch", func(t *testing.T) { - randomRepoPart := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomRepoPart := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-release-%s", testResourcePrefix, randomRepoPart) randomVersion := fmt.Sprintf("v1.0.%d", acctest.RandIntRange(0, 9999)) testBranchName := "test" diff --git a/github/resource_github_repository.go b/github/resource_github_repository.go index 9d756ac6c9..cf5d81dbbb 100644 --- a/github/resource_github_repository.go +++ b/github/resource_github_repository.go @@ -58,6 +58,7 @@ func resourceGithubRepository() *schema.Resource { Optional: true, ConflictsWith: []string{"visibility"}, Deprecated: "use visibility instead", + Description: "Deprecated: Use visibility instead. Set to 'true' to create a private repository.", }, "visibility": { Type: schema.TypeString, @@ -379,8 +380,9 @@ func resourceGithubRepository() *schema.Resource { Description: "The GitHub Pages site's build status e.g. building or built.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL for the Pages site.", }, }, }, @@ -401,6 +403,7 @@ func resourceGithubRepository() *schema.Resource { Computed: true, Description: "Set to 'true' to enable security alerts for vulnerable dependencies. Enabling requires alerts to be enabled on the owner level. (Note for importing: GitHub enables the alerts on all repos by default). Note that vulnerability alerts have not been successfully tested on any GitHub Enterprise instance and may be unavailable in those settings.", }, + // lintignore:XS001 // This is deprecated and will be removed in a future version. "ignore_vulnerability_alerts_during_read": { Type: schema.TypeBool, Optional: true, @@ -438,17 +441,19 @@ func resourceGithubRepository() *schema.Resource { Description: "URL that can be provided to 'git clone' to clone the repository via HTTPS.", }, "etag": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "An etag representing the repository.", DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool { return true }, DiffSuppressOnRefresh: true, }, "primary_language": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The primary language used in the repository.", }, "template": { Type: schema.TypeList, @@ -631,7 +636,8 @@ func resourceGithubRepositoryObject(d *schema.ResourceData) *github.Repository { // only configure allow forking if repository is not public if visibility != "public" && (d.IsNewResource() || d.HasChange("allow_forking")) { - if allowForking, ok := d.GetOkExists("allow_forking"); ok { //nolint:staticcheck,SA1019 // We sometimes need to use GetOkExists for booleans + // lintignore:XR001 + if allowForking, ok := d.GetOkExists("allow_forking"); ok { //nolint:staticcheck //SA1019 // We sometimes need to use GetOkExists for booleans if val, ok := allowForking.(bool); ok { repository.AllowForking = github.Ptr(val) } @@ -1001,6 +1007,7 @@ func resourceGithubRepositoryUpdate(ctx context.Context, d *schema.ResourceData, } if d.IsNewResource() || d.HasChange("vulnerability_alerts") { + // lintignore:XR001 if v, ok := d.GetOkExists("vulnerability_alerts"); ok { //nolint:staticcheck,SA1019 // We sometimes need to use GetOkExists for booleans if val, ok := v.(bool); ok { err := updateVulnerabilityAlerts(ctx, client, owner, repoName, val) diff --git a/github/resource_github_repository_autolink_reference.go b/github/resource_github_repository_autolink_reference.go index 9ee8c90eee..28fd7c3d3d 100644 --- a/github/resource_github_repository_autolink_reference.go +++ b/github/resource_github_repository_autolink_reference.go @@ -17,9 +17,10 @@ import ( func resourceGithubRepositoryAutolinkReference() *schema.Resource { return &schema.Resource{ - Create: resourceGithubRepositoryAutolinkReferenceCreate, - Read: resourceGithubRepositoryAutolinkReferenceRead, - Delete: resourceGithubRepositoryAutolinkReferenceDelete, + Description: "Manages an autolink reference for a repository.", + Create: resourceGithubRepositoryAutolinkReferenceCreate, + Read: resourceGithubRepositoryAutolinkReferenceRead, + Delete: resourceGithubRepositoryAutolinkReferenceDelete, Importer: &schema.ResourceImporter{ State: func(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { @@ -85,8 +86,9 @@ func resourceGithubRepositoryAutolinkReference() *schema.Resource { Description: "Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the autolink reference.", }, }, } diff --git a/github/resource_github_repository_autolink_reference_test.go b/github/resource_github_repository_autolink_reference_test.go index e97b14abf6..fa044f8e45 100644 --- a/github/resource_github_repository_autolink_reference_test.go +++ b/github/resource_github_repository_autolink_reference_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubRepositoryAutolinkReference(t *testing.T) { t.Run("creates repository autolink reference without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-autolink-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -106,7 +106,7 @@ func TestAccGithubRepositoryAutolinkReference(t *testing.T) { }) t.Run("imports repository autolink reference without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-autolink-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -229,7 +229,7 @@ func TestAccGithubRepositoryAutolinkReference(t *testing.T) { }) t.Run("imports repository autolink reference by key prefix without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-autolink-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "oof" { @@ -269,7 +269,7 @@ func TestAccGithubRepositoryAutolinkReference(t *testing.T) { }) t.Run("deletes repository autolink reference without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-autolink-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_repository_collaborator.go b/github/resource_github_repository_collaborator.go index ecb8d1bde9..9301319246 100644 --- a/github/resource_github_repository_collaborator.go +++ b/github/resource_github_repository_collaborator.go @@ -14,10 +14,11 @@ import ( func resourceGithubRepositoryCollaborator() *schema.Resource { return &schema.Resource{ - Create: resourceGithubRepositoryCollaboratorCreate, - Read: resourceGithubRepositoryCollaboratorRead, - Update: resourceGithubRepositoryCollaboratorUpdate, - Delete: resourceGithubRepositoryCollaboratorDelete, + Description: "Manages a collaborator for a repository.", + Create: resourceGithubRepositoryCollaboratorCreate, + Read: resourceGithubRepositoryCollaboratorRead, + Update: resourceGithubRepositoryCollaboratorUpdate, + Delete: resourceGithubRepositoryCollaboratorDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_repository_collaborator_test.go b/github/resource_github_repository_collaborator_test.go index 7a3d8a0a8d..bc5ea9c01c 100644 --- a/github/resource_github_repository_collaborator_test.go +++ b/github/resource_github_repository_collaborator_test.go @@ -15,7 +15,7 @@ func TestAccGithubRepositoryCollaborator(t *testing.T) { } t.Run("creates invitations without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-collab-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -50,7 +50,7 @@ func TestAccGithubRepositoryCollaborator(t *testing.T) { }) t.Run("creates invitations when repository contains the org name", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-collab-%s", testResourcePrefix, randomID) configWithOwner := fmt.Sprintf(` resource "github_repository" "test" { @@ -127,7 +127,7 @@ func TestAccGithubRepositoryCollaboratorArchivedRepo(t *testing.T) { t.Skip("GH_TEST_COLLABORATOR not set, skipping archived repository collaborator test") } t.Run("can delete collaborators from archived repositories without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-collab-arch-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_repository_collaborators.go b/github/resource_github_repository_collaborators.go index 2fafc28695..2ea6ea72c8 100644 --- a/github/resource_github_repository_collaborators.go +++ b/github/resource_github_repository_collaborators.go @@ -15,19 +15,21 @@ import ( func resourceGithubRepositoryCollaborators() *schema.Resource { return &schema.Resource{ - Create: resourceGithubRepositoryCollaboratorsCreate, - Read: resourceGithubRepositoryCollaboratorsRead, - Update: resourceGithubRepositoryCollaboratorsUpdate, - Delete: resourceGithubRepositoryCollaboratorsDelete, + Description: "Manages the complete set of collaborators and team access for a repository.", + Create: resourceGithubRepositoryCollaboratorsCreate, + Read: resourceGithubRepositoryCollaboratorsRead, + Update: resourceGithubRepositoryCollaboratorsUpdate, + Delete: resourceGithubRepositoryCollaboratorsDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, Schema: map[string]*schema.Schema{ "repository": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The name of the repository.", }, "user": { Type: schema.TypeSet, @@ -36,9 +38,10 @@ func resourceGithubRepositoryCollaborators() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "permission": { - Type: schema.TypeString, - Optional: true, - Default: "push", + Type: schema.TypeString, + Optional: true, + Default: "push", + Description: "The permission of the user (pull, triage, push, maintain, admin).", }, "username": { Type: schema.TypeString, @@ -56,9 +59,10 @@ func resourceGithubRepositoryCollaborators() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "permission": { - Type: schema.TypeString, - Optional: true, - Default: "push", + Type: schema.TypeString, + Optional: true, + Default: "push", + Description: "The permission of the team (pull, triage, push, maintain, admin).", }, "team_id": { Type: schema.TypeString, diff --git a/github/resource_github_repository_collaborators_test.go b/github/resource_github_repository_collaborators_test.go index 43e31b3b8d..2732de2dc6 100644 --- a/github/resource_github_repository_collaborators_test.go +++ b/github/resource_github_repository_collaborators_test.go @@ -24,7 +24,7 @@ func TestAccGithubRepositoryCollaborators(t *testing.T) { t.Run("adds user collaborator", func(t *testing.T) { conn := meta.v3client - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-collabs-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -93,7 +93,7 @@ func TestAccGithubRepositoryCollaborators(t *testing.T) { t.Run("adds team collaborator", func(t *testing.T) { ctx := t.Context() conn := meta.v3client - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-collabs-%s", testResourcePrefix, randomID) teamName := fmt.Sprintf("%steam-collabs-%s", testResourcePrefix, randomID) collaboratorUser := testAccConf.testOrgUser @@ -191,7 +191,7 @@ func TestAccGithubRepositoryCollaborators(t *testing.T) { ctx := t.Context() conn := meta.v3client - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-collabs-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -284,7 +284,7 @@ func TestAccGithubRepositoryCollaborators(t *testing.T) { ctx := t.Context() conn := meta.v3client - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-collabs-%s", testResourcePrefix, randomID) teamName1 := fmt.Sprintf("%steam-collabs-1-%s", testResourcePrefix, randomID) teamName2 := fmt.Sprintf("%steam-collabs-2-%s", testResourcePrefix, randomID) @@ -422,7 +422,7 @@ func TestAccGithubRepositoryCollaborators(t *testing.T) { t.Run("removes user collaborators without error", func(t *testing.T) { ctx := t.Context() conn := meta.v3client - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-collabs-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -485,7 +485,7 @@ func TestAccGithubRepositoryCollaborators(t *testing.T) { ctx := t.Context() conn := meta.v3client - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-collabs-%s", testResourcePrefix, randomID) teamName := fmt.Sprintf("%steam-collabs-%s", testResourcePrefix, randomID) diff --git a/github/resource_github_repository_custom_property.go b/github/resource_github_repository_custom_property.go index e5c5eae229..a0d3e7635e 100644 --- a/github/resource_github_repository_custom_property.go +++ b/github/resource_github_repository_custom_property.go @@ -11,9 +11,10 @@ import ( func resourceGithubRepositoryCustomProperty() *schema.Resource { return &schema.Resource{ - Create: resourceGithubRepositoryCustomPropertyCreate, - Read: resourceGithubRepositoryCustomPropertyRead, - Delete: resourceGithubRepositoryCustomPropertyDelete, + Description: "Manages a custom property value for a repository.", + Create: resourceGithubRepositoryCustomPropertyCreate, + Read: resourceGithubRepositoryCustomPropertyRead, + Delete: resourceGithubRepositoryCustomPropertyDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_repository_custom_property_test.go b/github/resource_github_repository_custom_property_test.go index 9fcb28b496..04338398ab 100644 --- a/github/resource_github_repository_custom_property_test.go +++ b/github/resource_github_repository_custom_property_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryCustomProperty(t *testing.T) { t.Run("creates custom property of type single_select without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-custom-prop-%s", testResourcePrefix, randomID) propertyName := fmt.Sprintf("tf-acc-test-property-%s", randomID) @@ -52,7 +52,7 @@ func TestAccGithubRepositoryCustomProperty(t *testing.T) { }) t.Run("creates custom property of type multi_select without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-custom-prop-%s", testResourcePrefix, randomID) propertyName := fmt.Sprintf("tf-acc-test-property-%s", randomID) @@ -95,7 +95,7 @@ func TestAccGithubRepositoryCustomProperty(t *testing.T) { }) t.Run("creates custom property of type true-false without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-custom-prop-%s", testResourcePrefix, randomID) propertyName := fmt.Sprintf("tf-acc-test-property-%s", randomID) @@ -136,7 +136,7 @@ func TestAccGithubRepositoryCustomProperty(t *testing.T) { }) t.Run("creates custom property of type string without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-custom-prop-%s", testResourcePrefix, randomID) propertyName := fmt.Sprintf("tf-acc-test-property-%s", randomID) diff --git a/github/resource_github_repository_dependabot_security_updates.go b/github/resource_github_repository_dependabot_security_updates.go index 85a49bb34c..eb37cf0cac 100644 --- a/github/resource_github_repository_dependabot_security_updates.go +++ b/github/resource_github_repository_dependabot_security_updates.go @@ -8,10 +8,11 @@ import ( func resourceGithubRepositoryDependabotSecurityUpdates() *schema.Resource { return &schema.Resource{ - Create: resourceGithubRepositoryDependabotSecurityUpdatesCreateOrUpdate, - Read: resourceGithubRepositoryDependabotSecurityUpdatesRead, - Update: resourceGithubRepositoryDependabotSecurityUpdatesCreateOrUpdate, - Delete: resourceGithubRepositoryDependabotSecurityUpdatesDelete, + Description: "Manages the Dependabot security updates setting for a repository.", + Create: resourceGithubRepositoryDependabotSecurityUpdatesCreateOrUpdate, + Read: resourceGithubRepositoryDependabotSecurityUpdatesRead, + Update: resourceGithubRepositoryDependabotSecurityUpdatesCreateOrUpdate, + Delete: resourceGithubRepositoryDependabotSecurityUpdatesDelete, Importer: &schema.ResourceImporter{ State: resourceGithubRepositoryDependabotSecurityUpdatesImport, }, diff --git a/github/resource_github_repository_dependabot_security_updates_test.go b/github/resource_github_repository_dependabot_security_updates_test.go index b656902f86..66f6e57f24 100644 --- a/github/resource_github_repository_dependabot_security_updates_test.go +++ b/github/resource_github_repository_dependabot_security_updates_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubRepositoryDependabotSecurityUpdates(t *testing.T) { t.Run("enables automated security fixes without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-depbot-updates-%s", testResourcePrefix, randomID) enabled := "enabled = false" updatedEnabled := "enabled = true" @@ -65,7 +65,7 @@ func TestAccGithubRepositoryDependabotSecurityUpdates(t *testing.T) { }) t.Run("disables automated security fixes without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-depbot-updates-%s", testResourcePrefix, randomID) enabled := "enabled = true" updatedEnabled := "enabled = false" @@ -120,7 +120,7 @@ func TestAccGithubRepositoryDependabotSecurityUpdates(t *testing.T) { }) t.Run("imports automated security fixes without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-depbot-updates-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_repository_deploy_key.go b/github/resource_github_repository_deploy_key.go index 9cd12c2836..f1c0aa1301 100644 --- a/github/resource_github_repository_deploy_key.go +++ b/github/resource_github_repository_deploy_key.go @@ -15,9 +15,10 @@ import ( func resourceGithubRepositoryDeployKey() *schema.Resource { return &schema.Resource{ - Create: resourceGithubRepositoryDeployKeyCreate, - Read: resourceGithubRepositoryDeployKeyRead, - Delete: resourceGithubRepositoryDeployKeyDelete, + Description: "Manages a deploy key for a repository.", + Create: resourceGithubRepositoryDeployKeyCreate, + Read: resourceGithubRepositoryDeployKeyRead, + Delete: resourceGithubRepositoryDeployKeyDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -51,8 +52,9 @@ func resourceGithubRepositoryDeployKey() *schema.Resource { Description: "A title.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the deploy key.", }, }, } diff --git a/github/resource_github_repository_deploy_key_test.go b/github/resource_github_repository_deploy_key_test.go index 973725836f..0c17c611cc 100644 --- a/github/resource_github_repository_deploy_key_test.go +++ b/github/resource_github_repository_deploy_key_test.go @@ -53,7 +53,7 @@ func TestSuppressDeployKeyDiff(t *testing.T) { func TestAccGithubRepositoryDeployKey_basic(t *testing.T) { t.Run("creates repository deploy key without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) keyName := fmt.Sprintf("%s_rsa", randomID) cmd := exec.Command("bash", "-c", fmt.Sprintf("ssh-keygen -t rsa -b 4096 -C test@example.com -N '' -f test-fixtures/%s>/dev/null <<< y >/dev/null", keyName)) if err := cmd.Run(); err != nil { @@ -61,7 +61,7 @@ func TestAccGithubRepositoryDeployKey_basic(t *testing.T) { } rn := "github_repository_deploy_key.test_repo_deploy_key" - rs := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) + rs := acctest.RandString(10) repositoryName := fmt.Sprintf("%srepo-deploy-key-%s", testResourcePrefix, rs) keyPath := strings.ReplaceAll(filepath.Join("test-fixtures", fmt.Sprintf("%s.pub", keyName)), "\\", "/") @@ -172,7 +172,7 @@ resource "github_repository_deploy_key" "test_repo_deploy_key" { func TestAccGithubRepositoryDeployKeyArchivedRepo(t *testing.T) { t.Run("can delete deploy keys from archived repositories without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) keyName := fmt.Sprintf("%s_rsa", randomID) cmd := exec.Command("bash", "-c", fmt.Sprintf("ssh-keygen -t rsa -b 4096 -C test@example.com -N '' -f test-fixtures/%s>/dev/null <<< y >/dev/null", keyName)) if err := cmd.Run(); err != nil { diff --git a/github/resource_github_repository_deployment_branch_policy.go b/github/resource_github_repository_deployment_branch_policy.go index a66c73afb1..2ffcd2a350 100644 --- a/github/resource_github_repository_deployment_branch_policy.go +++ b/github/resource_github_repository_deployment_branch_policy.go @@ -13,6 +13,7 @@ import ( func resourceGithubRepositoryDeploymentBranchPolicy() *schema.Resource { return &schema.Resource{ + Description: "Manages a deployment branch policy for a repository environment.", DeprecationMessage: "This resource is deprecated in favour of the github_repository_environment_deployment_policy resource.", Create: resourceGithubRepositoryDeploymentBranchPolicyCreate, diff --git a/github/resource_github_repository_deployment_branch_policy_test.go b/github/resource_github_repository_deployment_branch_policy_test.go index 49b13fc5ac..4a609fc065 100644 --- a/github/resource_github_repository_deployment_branch_policy_test.go +++ b/github/resource_github_repository_deployment_branch_policy_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryDeploymentBranchPolicy(t *testing.T) { t.Run("creates deployment branch policy", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-deploy-bp-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_repository_environment_deployment_policy_test.go b/github/resource_github_repository_environment_deployment_policy_test.go index 57508cffa2..be4b71ba93 100644 --- a/github/resource_github_repository_environment_deployment_policy_test.go +++ b/github/resource_github_repository_environment_deployment_policy_test.go @@ -12,7 +12,7 @@ import ( func TestAccGithubRepositoryEnvironmentDeploymentPolicy(t *testing.T) { t.Run("creates a repository environment with branch-based deployment policy", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "environment / test" config := fmt.Sprintf(` @@ -77,7 +77,7 @@ func TestAccGithubRepositoryEnvironmentDeploymentPolicy(t *testing.T) { }) t.Run("updates the pattern for a branch-based deployment policy", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-deploy-%s", testResourcePrefix, randomID) var deploymentPolicyId string @@ -190,7 +190,7 @@ func TestAccGithubRepositoryEnvironmentDeploymentPolicy(t *testing.T) { }) t.Run("creates a repository environment with tag-based deployment policy", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-deploy-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -255,7 +255,7 @@ func TestAccGithubRepositoryEnvironmentDeploymentPolicy(t *testing.T) { t.Run("updates the pattern for a tag-based deployment policy", func(t *testing.T) { var deploymentPolicyId string - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-deploy-%s", testResourcePrefix, randomID) config1 := fmt.Sprintf(` @@ -379,7 +379,7 @@ func TestAccGithubRepositoryEnvironmentDeploymentPolicy(t *testing.T) { t.Run("recreates deployment policy when pattern type changes from branch to tag", func(t *testing.T) { var deploymentPolicyId string - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-deploy-%s", testResourcePrefix, randomID) config1 := fmt.Sprintf(` @@ -503,7 +503,7 @@ func TestAccGithubRepositoryEnvironmentDeploymentPolicy(t *testing.T) { t.Run("recreates deployment policy when pattern type changes from tag to branch", func(t *testing.T) { var deploymentPolicyId string - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-deploy-%s", testResourcePrefix, randomID) config1 := fmt.Sprintf(` @@ -626,7 +626,7 @@ func TestAccGithubRepositoryEnvironmentDeploymentPolicy(t *testing.T) { }) t.Run("import", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "environment / test" config := fmt.Sprintf(` @@ -676,7 +676,7 @@ resource "github_repository_environment_deployment_policy" "test" { }) t.Run("errors when no patterns are set", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-deploy-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -711,7 +711,7 @@ resource "github_repository_environment_deployment_policy" "test" { }) t.Run("errors when both patterns are set", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-deploy-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -748,7 +748,7 @@ resource "github_repository_environment_deployment_policy" "test" { }) t.Run("errors when an empty branch pattern is set", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-deploy-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -784,7 +784,7 @@ resource "github_repository_environment_deployment_policy" "test" { }) t.Run("errors when an empty tag pattern is set", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-env-deploy-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_repository_environment_test.go b/github/resource_github_repository_environment_test.go index 3ea4e60d18..9235a550e4 100644 --- a/github/resource_github_repository_environment_test.go +++ b/github/resource_github_repository_environment_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryEnvironment(t *testing.T) { t.Run("creates a repository environment", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "environment / test" config := fmt.Sprintf(` @@ -62,7 +62,7 @@ func TestAccGithubRepositoryEnvironment(t *testing.T) { }) t.Run("creates a repository environment with id separator", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "environment:test" config := fmt.Sprintf(` @@ -114,7 +114,7 @@ func TestAccGithubRepositoryEnvironment(t *testing.T) { }) t.Run("import", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) envName := "environment / test" config := fmt.Sprintf(` diff --git a/github/resource_github_repository_file.go b/github/resource_github_repository_file.go index 3a31edb55e..f9dcc8fc97 100644 --- a/github/resource_github_repository_file.go +++ b/github/resource_github_repository_file.go @@ -66,7 +66,6 @@ func resourceGithubRepositoryFile() *schema.Resource { Type: schema.TypeString, Computed: true, Description: "The name of the commit/branch/tag", - ForceNew: true, }, "commit_sha": { Type: schema.TypeString, @@ -82,14 +81,12 @@ func resourceGithubRepositoryFile() *schema.Resource { "commit_author": { Type: schema.TypeString, Optional: true, - Computed: false, Description: "The commit author name, defaults to the authenticated user's name. GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. ", RequiredWith: []string{"commit_email"}, }, "commit_email": { Type: schema.TypeString, Optional: true, - Computed: false, Description: "The commit author email address, defaults to the authenticated user's email address. GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App.", RequiredWith: []string{"commit_author"}, }, @@ -506,7 +503,7 @@ func resourceGithubRepositoryFileCreateBranch(ctx context.Context, d *schema.Res return fmt.Errorf("error querying GitHub branch reference %s/%s (%s): %s", owner, repo, sourceBranchRefName, err.Error()) } - err = d.Set("autocreate_branch_source_sha", *ref.Object.SHA) + err = d.Set("autocreate_branch_source_sha", ref.Object.GetSHA()) if err != nil { return fmt.Errorf("error setting autocreate_branch_source_sha: %w", err) } diff --git a/github/resource_github_repository_file_migration.go b/github/resource_github_repository_file_migration.go index 1c6739e58d..68e2cb21a2 100644 --- a/github/resource_github_repository_file_migration.go +++ b/github/resource_github_repository_file_migration.go @@ -11,69 +11,83 @@ import ( func resourceGithubRepositoryFileV0() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ + // lintignore:XS001 // No changes to old schema versions "repository": { Type: schema.TypeString, Required: true, ForceNew: true, }, + // lintignore:XS001 // No changes to old schema versions "file": { Type: schema.TypeString, Required: true, ForceNew: true, }, + // lintignore:XS001 // No changes to old schema versions "content": { Type: schema.TypeString, Required: true, }, + // lintignore:XS001 // No changes to old schema versions "branch": { Type: schema.TypeString, Optional: true, ForceNew: true, }, + // lintignore:XS001,S020 // No changes to old schema versions "ref": { Type: schema.TypeString, Computed: true, ForceNew: true, }, + // lintignore:XS001 // No changes to old schema versions "commit_sha": { Type: schema.TypeString, Computed: true, }, + // lintignore:XS001 // No changes to old schema versions "commit_message": { Type: schema.TypeString, Optional: true, Computed: true, }, + // lintignore:XS001 // No changes to old schema versions "commit_author": { Type: schema.TypeString, Optional: true, RequiredWith: []string{"commit_email"}, }, + // lintignore:XS001 // No changes to old schema versions "commit_email": { Type: schema.TypeString, Optional: true, RequiredWith: []string{"commit_author"}, }, + // lintignore:XS001 // No changes to old schema versions "sha": { Type: schema.TypeString, Computed: true, }, + // lintignore:XS001 // No changes to old schema versions "overwrite_on_create": { Type: schema.TypeBool, Optional: true, Default: false, }, + // lintignore:XS001 // No changes to old schema versions "autocreate_branch": { Type: schema.TypeBool, Optional: true, Default: false, }, + // lintignore:XS001 // No changes to old schema versions "autocreate_branch_source_branch": { Type: schema.TypeString, Default: "main", Optional: true, RequiredWith: []string{"autocreate_branch"}, }, + // lintignore:XS001 // No changes to old schema versions "autocreate_branch_source_sha": { Type: schema.TypeString, Optional: true, diff --git a/github/resource_github_repository_file_test.go b/github/resource_github_repository_file_test.go index 57343b6dd8..cff263d031 100644 --- a/github/resource_github_repository_file_test.go +++ b/github/resource_github_repository_file_test.go @@ -12,7 +12,7 @@ import ( func TestAccGithubRepositoryFile(t *testing.T) { t.Run("creates and manages files", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-file-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -123,7 +123,7 @@ func TestAccGithubRepositoryFile(t *testing.T) { }) t.Run("can be configured to overwrite files on create", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-file-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -190,7 +190,7 @@ func TestAccGithubRepositoryFile(t *testing.T) { }) t.Run("creates and manages files on default branch if branch is omitted", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-file-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -253,7 +253,7 @@ func TestAccGithubRepositoryFile(t *testing.T) { }) t.Run("creates and manages files on auto created branch if branch does not exist", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-file-%s", testResourcePrefix, randomID) config := ` resource "github_repository" "test" { @@ -303,7 +303,7 @@ func TestAccGithubRepositoryFile(t *testing.T) { }) t.Run("can delete files from archived repositories without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-file-arch-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { diff --git a/github/resource_github_repository_migration.go b/github/resource_github_repository_migration.go index a5a570461d..83edfa102c 100644 --- a/github/resource_github_repository_migration.go +++ b/github/resource_github_repository_migration.go @@ -16,185 +16,226 @@ func resourceGithubRepositoryResourceV0() *schema.Resource { Optional: true, Computed: true, ConflictsWith: []string{"name"}, + Description: "Full name of the repository (in org/name format).", }, "name": { Type: schema.TypeString, Optional: true, Computed: true, ConflictsWith: []string{"full_name"}, + Description: "The name of the repository.", }, "only_protected_branches": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "Only consider protected branches when looking for default branch.", }, "description": { - Type: schema.TypeString, - Default: nil, - Optional: true, + Type: schema.TypeString, + Default: nil, + Optional: true, + Description: "A description of the repository.", }, "homepage_url": { - Type: schema.TypeString, - Default: "", - Optional: true, + Type: schema.TypeString, + Default: "", + Optional: true, + Description: "URL of a page describing the project.", }, "private": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Set to true to create a private repository.", }, "visibility": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Can be public or private.", }, "has_issues": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Set to true to enable the GitHub Issues features on the repository.", }, "has_projects": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Set to true to enable the GitHub Projects features on the repository.", }, "has_downloads": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Set to true to enable the (deprecated) downloads features on the repository.", }, "has_wiki": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Set to true to enable the GitHub Wiki features on the repository.", }, "allow_merge_commit": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Set to false to disable merge commits on the repository.", }, "allow_squash_merge": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Set to false to disable squash merges on the repository.", }, "allow_rebase_merge": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Set to false to disable rebase merges on the repository.", }, "allow_auto_merge": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Set to true to allow auto-merging pull requests on the repository.", }, "squash_merge_commit_title": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Can be PR_TITLE or COMMIT_OR_PR_TITLE.", }, "squash_merge_commit_message": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Can be PR_BODY, COMMIT_MESSAGES, or BLANK.", }, "merge_commit_title": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Can be PR_TITLE or MERGE_MESSAGE.", }, "merge_commit_message": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "Can be PR_BODY, PR_TITLE, or BLANK.", }, "default_branch": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The default branch of the repository.", }, "archived": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Specifies if the repository should be archived.", }, "branches": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "Deprecated: Use github_branch data source instead. The list of branches.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The name of the branch.", }, "protected": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the branch is protected.", }, }, }, }, "pages": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The repository's GitHub Pages configuration.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "source": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "The source branch and directory for the rendered Pages site.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "branch": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The repository branch used to publish the site's source files.", }, "path": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The repository directory from which the site publishes.", }, }, }, }, "cname": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The custom domain for the repository.", }, "custom_404": { - Type: schema.TypeBool, - Computed: true, + Type: schema.TypeBool, + Computed: true, + Description: "Whether the rendered site has a custom 404 page.", }, "html_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "HTML URL for the rendered site.", }, "status": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The GitHub Pages site's build status.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "The URL for the Pages site.", }, }, }, }, "topics": { - Type: schema.TypeList, - Elem: &schema.Schema{Type: schema.TypeString}, - Computed: true, + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Computed: true, + Description: "The list of topics of the repository.", }, "html_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL to the repository on the web.", }, "ssh_clone_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL that can be provided to git clone to clone the repository via SSH.", }, "svn_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL that can be provided to svn checkout to check out the repository via SVN.", }, "git_clone_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL that can be provided to git clone to clone the repository anonymously via the git protocol.", }, "http_clone_url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL that can be provided to git clone to clone the repository via HTTPS.", }, "node_id": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "GraphQL global node id for use with v4 API.", }, "repo_id": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "GitHub ID for the repository.", }, }, } diff --git a/github/resource_github_repository_milestone.go b/github/resource_github_repository_milestone.go index 680db860e0..13f481a689 100644 --- a/github/resource_github_repository_milestone.go +++ b/github/resource_github_repository_milestone.go @@ -17,10 +17,11 @@ import ( func resourceGithubRepositoryMilestone() *schema.Resource { return &schema.Resource{ - Create: resourceGithubRepositoryMilestoneCreate, - Read: resourceGithubRepositoryMilestoneRead, - Update: resourceGithubRepositoryMilestoneUpdate, - Delete: resourceGithubRepositoryMilestoneDelete, + Description: "Manages a milestone within a repository.", + Create: resourceGithubRepositoryMilestoneCreate, + Read: resourceGithubRepositoryMilestoneRead, + Update: resourceGithubRepositoryMilestoneUpdate, + Delete: resourceGithubRepositoryMilestoneDelete, Importer: &schema.ResourceImporter{ State: func(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { parts := strings.Split(d.Id(), "/") @@ -192,17 +193,17 @@ func resourceGithubRepositoryMilestoneUpdate(d *schema.ResourceData, meta any) e milestone := &github.Milestone{} if d.HasChanges("title") { - _, n := d.GetChange("title") + n := d.Get("title") milestone.Title = github.Ptr(n.(string)) } if d.HasChanges("description") { - _, n := d.GetChange("description") + n := d.Get("description") milestone.Description = github.Ptr(n.(string)) } if d.HasChanges("due_date") { - _, n := d.GetChange("due_date") + n := d.Get("due_date") dueDate, err := time.Parse(layoutISO, n.(string)) if err != nil { return err @@ -214,7 +215,7 @@ func resourceGithubRepositoryMilestoneUpdate(d *schema.ResourceData, meta any) e } if d.HasChanges("state") { - _, n := d.GetChange("state") + n := d.Get("state") milestone.State = github.Ptr(n.(string)) } diff --git a/github/resource_github_repository_milestone_test.go b/github/resource_github_repository_milestone_test.go index 82cd4221d2..9ab0bcbac7 100644 --- a/github/resource_github_repository_milestone_test.go +++ b/github/resource_github_repository_milestone_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryMilestone(t *testing.T) { t.Run("creates a repository milestone", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-milestone-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_repository_project.go b/github/resource_github_repository_project.go index f83c9aaed7..0d467ebe78 100644 --- a/github/resource_github_repository_project.go +++ b/github/resource_github_repository_project.go @@ -9,6 +9,7 @@ import ( func resourceGithubRepositoryProject() *schema.Resource { return &schema.Resource{ + Description: "Manages a classic project within a repository.", DeprecationMessage: "This resource is deprecated as the API endpoints for classic projects have been removed. This resource no longer works and will be removed in a future version.", Create: resourceGithubRepositoryProjectCreate, @@ -52,9 +53,10 @@ func resourceGithubRepositoryProject() *schema.Resource { Description: "URL of the project", }, "etag": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "An etag representing the repository project.", DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool { return true }, diff --git a/github/resource_github_repository_project_test.go b/github/resource_github_repository_project_test.go index fcf6b8fa26..b6e54a13af 100644 --- a/github/resource_github_repository_project_test.go +++ b/github/resource_github_repository_project_test.go @@ -13,7 +13,7 @@ func TestAccGithubRepositoryProject(t *testing.T) { t.Skip("Skipping test as the GitHub API no longer supports classic projects") t.Run("creates a repository project", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-project-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_repository_pull_request.go b/github/resource_github_repository_pull_request.go index 9508001bf6..3c00d73dc2 100644 --- a/github/resource_github_repository_pull_request.go +++ b/github/resource_github_repository_pull_request.go @@ -13,10 +13,11 @@ import ( func resourceGithubRepositoryPullRequest() *schema.Resource { return &schema.Resource{ - Create: resourceGithubRepositoryPullRequestCreate, - Read: resourceGithubRepositoryPullRequestRead, - Update: resourceGithubRepositoryPullRequestUpdate, - Delete: resourceGithubRepositoryPullRequestDelete, + Description: "Manages a pull request within a repository.", + Create: resourceGithubRepositoryPullRequestCreate, + Read: resourceGithubRepositoryPullRequestRead, + Update: resourceGithubRepositoryPullRequestUpdate, + Delete: resourceGithubRepositoryPullRequestDelete, Importer: &schema.ResourceImporter{ State: func(d *schema.ResourceData, m any) ([]*schema.ResourceData, error) { _, baseRepository, _, err := parsePullRequestID(d) diff --git a/github/resource_github_repository_pull_request_test.go b/github/resource_github_repository_pull_request_test.go index 71e1ad2ebc..67c5b20f71 100644 --- a/github/resource_github_repository_pull_request_test.go +++ b/github/resource_github_repository_pull_request_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryPullRequest(t *testing.T) { t.Run("manages the pull request lifecycle", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-pr-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_repository_ruleset.go b/github/resource_github_repository_ruleset.go index 460473e857..23182e1911 100644 --- a/github/resource_github_repository_ruleset.go +++ b/github/resource_github_repository_ruleset.go @@ -103,9 +103,10 @@ func resourceGithubRepositoryRuleset() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "ref_name": { - Type: schema.TypeList, - Required: true, - MaxItems: 1, + Type: schema.TypeList, + Required: true, + MaxItems: 1, + Description: "The ref (branch or tag) name patterns to include/exclude.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": { @@ -677,8 +678,9 @@ func resourceGithubRepositoryRuleset() *schema.Resource { }, }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the ruleset.", }, }, } @@ -767,6 +769,7 @@ func resourceGithubRepositoryRulesetRead(ctx context.Context, d *schema.Resource if err := d.Set("name", ruleset.Name); err != nil { return diag.FromErr(err) } + // lintignore:R004 // `github.RulesetTarget` is a string if err := d.Set("target", ruleset.GetTarget()); err != nil { return diag.FromErr(err) } diff --git a/github/resource_github_repository_ruleset_test.go b/github/resource_github_repository_ruleset_test.go index a10affa289..81bf0a8746 100644 --- a/github/resource_github_repository_ruleset_test.go +++ b/github/resource_github_repository_ruleset_test.go @@ -20,7 +20,7 @@ func TestAccGithubRepositoryRuleset(t *testing.T) { } t.Run("create_branch_ruleset", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ruleset-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -151,7 +151,7 @@ resource "github_repository_ruleset" "test" { }) t.Run("create_branch_ruleset_with_enterprise_features", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ruleset-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -207,7 +207,7 @@ resource "github_repository_ruleset" "test" { }) t.Run("creates_push_ruleset", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ruleset-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -278,7 +278,7 @@ resource "github_repository_ruleset" "test" { }) t.Run("update_ruleset_name", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ruleset-rename-%s", testResourcePrefix, randomID) name := fmt.Sprintf("ruleset-%s", randomID) nameUpdated := fmt.Sprintf("%s-renamed", name) @@ -324,7 +324,7 @@ resource "github_repository_ruleset" "test" { }) t.Run("update_clear_bypass_actors", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ruleset-bypass-%s", testResourcePrefix, randomID) bypassActorsConfig := ` @@ -391,7 +391,7 @@ resource "github_repository_ruleset" "test" { }) t.Run("update_bypass_mode", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ruleset-bypass-update-%s", testResourcePrefix, randomID) bypassMode := "always" @@ -451,7 +451,7 @@ resource "github_repository_ruleset" "test" { }) t.Run("import", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ruleset-bpmod-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -516,7 +516,7 @@ func TestAccGithubRepositoryRulesetArchived(t *testing.T) { } t.Run("skips update and delete on archived repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ruleset-arch-%s", testResourcePrefix, randomID) archivedBefore := false archivedAfter := true @@ -551,7 +551,7 @@ func TestAccGithubRepositoryRulesetArchived(t *testing.T) { }) t.Run("prevents creating ruleset on archived repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ruleset-arch-cr-%s", testResourcePrefix, randomID) repoConfig := ` resource "github_repository" "test" { @@ -590,7 +590,7 @@ resource "github_repository_ruleset" "test" { func TestAccGithubRepositoryRulesetValidation(t *testing.T) { t.Run("Validates push target rejects ref_name condition", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -634,7 +634,7 @@ func TestAccGithubRepositoryRulesetValidation(t *testing.T) { }) t.Run("Validates push target rejects branch/tag rules", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_repository" "test" { name = "tf-acc-test-push-rules-%s" @@ -669,7 +669,7 @@ func TestAccGithubRepositoryRulesetValidation(t *testing.T) { }) t.Run("Validates branch target rejects push-only rules", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_repository" "test" { name = "tf-acc-test-branch-push-%s" @@ -714,7 +714,7 @@ func TestAccGithubRepositoryRulesetValidation(t *testing.T) { }) t.Run("Validates tag target rejects push-only rules", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) config := fmt.Sprintf(` resource "github_repository" "test" { name = "tf-acc-test-tag-push-%s" @@ -760,7 +760,7 @@ func TestAccGithubRepositoryRulesetValidation(t *testing.T) { } func TestAccGithubRepositoryRuleset_requiredReviewers(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-ruleset-req-rev-%s", testResourcePrefix, randomID) teamName := fmt.Sprintf("%steam-req-rev-%s", testResourcePrefix, randomID) rulesetName := fmt.Sprintf("%s-ruleset-req-rev-%s", testResourcePrefix, randomID) diff --git a/github/resource_github_repository_test.go b/github/resource_github_repository_test.go index 1589c84bf1..236a8c2306 100644 --- a/github/resource_github_repository_test.go +++ b/github/resource_github_repository_test.go @@ -16,7 +16,7 @@ import ( func TestAccGithubRepository(t *testing.T) { t.Run("creates and updates repositories without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%screate-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -74,7 +74,7 @@ func TestAccGithubRepository(t *testing.T) { }) t.Run("updates a repositories name without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) oldName := fmt.Sprintf(`%srename-%s`, testResourcePrefix, randomID) newName := fmt.Sprintf(`%s-renamed`, oldName) @@ -129,7 +129,7 @@ func TestAccGithubRepository(t *testing.T) { }) t.Run("imports repositories without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -162,7 +162,7 @@ func TestAccGithubRepository(t *testing.T) { }) t.Run("archives repositories without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := ` @@ -193,7 +193,7 @@ resource "github_repository" "test" { }) t.Run("manages the project feature for a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sproject-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -237,7 +237,7 @@ resource "github_repository" "test" { }) t.Run("manages the default branch feature for a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sbranch-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -296,7 +296,7 @@ resource "github_repository" "test" { // Although default_branch is deprecated, for backwards compatibility // we allow setting it to "main". - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sempty-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -335,7 +335,7 @@ resource "github_repository" "test" { }) t.Run("manages the license and gitignore feature for a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%slicense-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -370,7 +370,7 @@ resource "github_repository" "test" { }) t.Run("configures_topics_for_a_repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%stopic-%s", testResourcePrefix, randomID) topicsBefore := `["terraform", "testing"]` topicsAfter := `["terraform", "testing", "extra-topic"]` @@ -403,7 +403,7 @@ resource "github_repository" "test" { }) t.Run("creates a repository using a public template", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%stemplate-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -433,7 +433,7 @@ resource "github_repository" "test" { }) t.Run("creates a repository using an org template", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%stemplate-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -463,7 +463,7 @@ resource "github_repository" "test" { }) t.Run("archives repositories on destroy", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := ` @@ -496,7 +496,7 @@ resource "github_repository" "test" { }) t.Run("create_private_with_forking", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -524,7 +524,7 @@ resource "github_repository" "test" { }) t.Run("create_private_without_forking", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -552,7 +552,7 @@ resource "github_repository" "test" { }) t.Run("create_private_with_forking_unset", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -578,7 +578,7 @@ resource "github_repository" "test" { }) t.Run("update_public_to_private_allow_forking", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%svisibility-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -633,7 +633,7 @@ resource "github_repository" "test" { }) t.Run("create_with_vulnerability_alerts", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -660,7 +660,7 @@ resource "github_repository" "test" { }) t.Run("create_without_vulnerability_alerts", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -687,7 +687,7 @@ resource "github_repository" "test" { }) t.Run("create_with_vulnerability_alerts_unset", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -712,7 +712,7 @@ resource "github_repository" "test" { }) t.Run("update_vulnerability_alerts", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -754,7 +754,7 @@ resource "github_repository" "test" { }) t.Run("create and modify merge commit strategy without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%smodify-co-str-%s", testResourcePrefix, randomID) mergeCommitTitle := "PR_TITLE" mergeCommitMessage := "BLANK" @@ -804,7 +804,7 @@ resource "github_repository" "test" { }) t.Run("create and modify squash merge commit strategy without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%smodify-sq-str-%s", testResourcePrefix, randomID) testRepoNameAfter := fmt.Sprintf("%s-modified", testRepoName) squashMergeCommitTitle := "PR_TITLE" @@ -859,7 +859,7 @@ resource "github_repository" "test" { }) // t.Run("create a repository with go as primary_language", func(t *testing.T) { - // randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + // randomID := acctest.RandString(5) // testResourceName := fmt.Sprintf("%srepo-%s", testResourcePrefix, randomID) // config := fmt.Sprintf(` // resource "github_repository" "test" { @@ -895,7 +895,7 @@ resource "github_repository" "test" { // }) t.Run("manages the legacy pages feature for a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%slegacy-pages-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -927,7 +927,7 @@ resource "github_repository" "test" { }) t.Run("manages the pages from workflow feature for a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sworkflow-pages-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -958,7 +958,7 @@ resource "github_repository" "test" { t.Skip("Advanced Security is not enabled for this account") } - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%ssecurity-private-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -1027,7 +1027,7 @@ resource "github_repository" "test" { }) t.Run("manages the security feature for a public repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%ssecurity-public-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -1069,7 +1069,7 @@ resource "github_repository" "test" { }) t.Run("creates repos with private visibility", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%svisibility-private-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "private" { @@ -1093,7 +1093,7 @@ resource "github_repository" "test" { }) t.Run("creates repos with internal visibility", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%svisibility-internal-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -1117,7 +1117,7 @@ resource "github_repository" "test" { }) t.Run("updates repos to private visibility", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%svisibility-public-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "public" { @@ -1159,7 +1159,7 @@ resource "github_repository" "test" { }) t.Run("updates repos to public visibility", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%spublic-vuln-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -1206,7 +1206,7 @@ resource "github_repository" "test" { }) t.Run("updates repos to internal visibility", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sinternal-vuln-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -1253,7 +1253,7 @@ resource "github_repository" "test" { }) t.Run("sets private visibility for repositories created by a template", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%stemplate-visibility-private-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "private" { @@ -1290,7 +1290,7 @@ resource "github_repository" "test" { }) t.Run("create_internal_repo_from_template", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -1321,7 +1321,7 @@ resource "github_repository" "test" { t.Run("check_allow_forking_not_set", func(t *testing.T) { t.Skip("This test should be run manually after confirming that the test organization has been correctly configured to disable setting forking at the repo level.") - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := ` @@ -1352,7 +1352,7 @@ resource "github_repository" "private" { t.Run("check_vulnerability_alerts_not_set", func(t *testing.T) { t.Skip("This test should be run manually after confirming that the test organization has been correctly configured to disable setting vulnerability alerts at the repo level.") - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%s%s", testResourcePrefix, randomID) config := ` @@ -1379,53 +1379,8 @@ resource "github_repository" "private" { }, }) }) -} - -func Test_expandPages(t *testing.T) { - t.Run("expand Pages configuration with workflow", func(t *testing.T) { - input := []any{map[string]any{ - "build_type": "workflow", - "source": []any{map[string]any{}}, - }} - - pages := expandPages(input) - if pages == nil { - t.Fatal("pages is nil") - } - if pages.GetBuildType() != "workflow" { - t.Errorf("got %q; want %q", pages.GetBuildType(), "workflow") - } - if pages.GetSource().GetBranch() != "main" { - t.Errorf("got %q; want %q", pages.GetSource().GetBranch(), "main") - } - }) - - t.Run("expand Pages configuration with source", func(t *testing.T) { - input := []any{map[string]any{ - "build_type": "legacy", - "source": []any{map[string]any{ - "branch": "main", - "path": "/docs", - }}, - }} - - pages := expandPages(input) - if pages == nil { - t.Fatal("pages is nil") - } - if pages.GetBuildType() != "legacy" { - t.Errorf("got %q; want %q", pages.GetBuildType(), "legacy") - } - if pages.GetSource().GetBranch() != "main" { - t.Errorf("got %q; want %q", pages.GetSource().GetBranch(), "main") - } - if pages.GetSource().GetPath() != "/docs" { - t.Errorf("got %q; want %q", pages.GetSource().GetPath(), "/docs") - } - }) - t.Run("forks a repository without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sfork-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "forked" { @@ -1469,7 +1424,7 @@ func Test_expandPages(t *testing.T) { }) t.Run("can update forked repository properties", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testRepoName := fmt.Sprintf("%sfork-update-%s", testResourcePrefix, randomID) initialConfig := fmt.Sprintf(` resource "github_repository" "forked_update" { @@ -1549,6 +1504,50 @@ func Test_expandPages(t *testing.T) { }) } +func Test_expandPages(t *testing.T) { + t.Run("expand Pages configuration with workflow", func(t *testing.T) { + input := []any{map[string]any{ + "build_type": "workflow", + "source": []any{map[string]any{}}, + }} + + pages := expandPages(input) + if pages == nil { + t.Fatal("pages is nil") + } + if pages.GetBuildType() != "workflow" { + t.Errorf("got %q; want %q", pages.GetBuildType(), "workflow") + } + if pages.GetSource().GetBranch() != "main" { + t.Errorf("got %q; want %q", pages.GetSource().GetBranch(), "main") + } + }) + + t.Run("expand Pages configuration with source", func(t *testing.T) { + input := []any{map[string]any{ + "build_type": "legacy", + "source": []any{map[string]any{ + "branch": "main", + "path": "/docs", + }}, + }} + + pages := expandPages(input) + if pages == nil { + t.Fatal("pages is nil") + } + if pages.GetBuildType() != "legacy" { + t.Errorf("got %q; want %q", pages.GetBuildType(), "legacy") + } + if pages.GetSource().GetBranch() != "main" { + t.Errorf("got %q; want %q", pages.GetSource().GetBranch(), "main") + } + if pages.GetSource().GetPath() != "/docs" { + t.Errorf("got %q; want %q", pages.GetSource().GetPath(), "/docs") + } + }) +} + func TestGithubRepositoryTopicPassesValidation(t *testing.T) { resource := resourceGithubRepository() schema := resource.Schema["topics"].Elem.(*schema.Schema) diff --git a/github/resource_github_repository_topics.go b/github/resource_github_repository_topics.go index 3c5d5a5113..3cde664031 100644 --- a/github/resource_github_repository_topics.go +++ b/github/resource_github_repository_topics.go @@ -14,10 +14,11 @@ import ( func resourceGithubRepositoryTopics() *schema.Resource { return &schema.Resource{ - Create: resourceGithubRepositoryTopicsCreateOrUpdate, - Read: resourceGithubRepositoryTopicsRead, - Update: resourceGithubRepositoryTopicsCreateOrUpdate, - Delete: resourceGithubRepositoryTopicsDelete, + Description: "Manages topics for a repository.", + Create: resourceGithubRepositoryTopicsCreateOrUpdate, + Read: resourceGithubRepositoryTopicsRead, + Update: resourceGithubRepositoryTopicsCreateOrUpdate, + Delete: resourceGithubRepositoryTopicsDelete, Importer: &schema.ResourceImporter{ State: func(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { _ = d.Set("repository", d.Id()) diff --git a/github/resource_github_repository_topics_test.go b/github/resource_github_repository_topics_test.go index b6ef36ab30..4b6ddd01ad 100644 --- a/github/resource_github_repository_topics_test.go +++ b/github/resource_github_repository_topics_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryTopics(t *testing.T) { t.Run("create repository topics and import them", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-topics-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -49,7 +49,7 @@ func TestAccGithubRepositoryTopics(t *testing.T) { }) t.Run("create repository topics and update them", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-topics-%s", testResourcePrefix, randomID) configBefore := fmt.Sprintf(` diff --git a/github/resource_github_repository_webhook.go b/github/resource_github_repository_webhook.go index 3defdb23ee..7b7b3ba9e9 100644 --- a/github/resource_github_repository_webhook.go +++ b/github/resource_github_repository_webhook.go @@ -70,9 +70,10 @@ func resourceGithubRepositoryWebhook() *schema.Resource { Description: "Indicate if the webhook should receive events. Defaults to 'true'.", }, "etag": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "An etag representing the webhook.", DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool { return true }, diff --git a/github/resource_github_repository_webhook_migration.go b/github/resource_github_repository_webhook_migration.go index 53ec661701..42c06f6a35 100644 --- a/github/resource_github_repository_webhook_migration.go +++ b/github/resource_github_repository_webhook_migration.go @@ -12,33 +12,40 @@ func resourceGithubRepositoryWebhookResourceV0() *schema.Resource { return &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The type of the webhook.", }, "repository": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "The name of the repository.", }, "events": { - Type: schema.TypeSet, - Required: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, + Type: schema.TypeSet, + Required: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "A list of events which should trigger the webhook.", }, "configuration": { - Type: schema.TypeMap, - Optional: true, + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Webhook configuration options.", }, "url": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "URL of the webhook.", }, "active": { - Type: schema.TypeBool, - Optional: true, - Default: true, + Type: schema.TypeBool, + Optional: true, + Default: true, + Description: "Indicate if the webhook should receive events.", }, }, } diff --git a/github/resource_github_repository_webhook_test.go b/github/resource_github_repository_webhook_test.go index 7ec97ab083..c4e775489b 100644 --- a/github/resource_github_repository_webhook_test.go +++ b/github/resource_github_repository_webhook_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubRepositoryWebhook(t *testing.T) { t.Run("creates repository webhooks without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-webhook-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -54,7 +54,7 @@ func TestAccGithubRepositoryWebhook(t *testing.T) { }) t.Run("imports repository webhooks without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-webhook-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_repository" "test" { @@ -95,7 +95,7 @@ func TestAccGithubRepositoryWebhook(t *testing.T) { }) t.Run("updates repository webhooks without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-webhook-%s", testResourcePrefix, randomID) configs := map[string]string{ "before": fmt.Sprintf(` diff --git a/github/resource_github_team.go b/github/resource_github_team.go index 6f823e730d..1d6ba93056 100644 --- a/github/resource_github_team.go +++ b/github/resource_github_team.go @@ -84,8 +84,9 @@ func resourceGithubTeam() *schema.Resource { Description: "The slug of the created team.", }, "members_count": { - Type: schema.TypeInt, - Computed: true, + Type: schema.TypeInt, + Computed: true, + Description: "The number of members in the team.", }, "parent_team_read_id": { Type: schema.TypeString, @@ -105,8 +106,9 @@ func resourceGithubTeam() *schema.Resource { Description: "The Node ID of the created team.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the team.", }, }, } diff --git a/github/resource_github_team_members.go b/github/resource_github_team_members.go index 6bb22e2c60..9c3eedda6c 100644 --- a/github/resource_github_team_members.go +++ b/github/resource_github_team_members.go @@ -18,10 +18,11 @@ type MemberChange struct { func resourceGithubTeamMembers() *schema.Resource { return &schema.Resource{ - Create: resourceGithubTeamMembersCreate, - Read: resourceGithubTeamMembersRead, - Update: resourceGithubTeamMembersUpdate, - Delete: resourceGithubTeamMembersDelete, + Description: "Manages the complete set of members for a team.", + Create: resourceGithubTeamMembersCreate, + Read: resourceGithubTeamMembersRead, + Update: resourceGithubTeamMembersUpdate, + Delete: resourceGithubTeamMembersDelete, Importer: &schema.ResourceImporter{ State: resourceGithubTeamMembersImport, }, diff --git a/github/resource_github_team_members_test.go b/github/resource_github_team_members_test.go index 132b80ca25..11145819d2 100644 --- a/github/resource_github_team_members_test.go +++ b/github/resource_github_team_members_test.go @@ -16,7 +16,7 @@ func TestAccGithubTeamMembers(t *testing.T) { } t.Run("creates a team & members configured with defaults", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-members-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_github_team_membership.go b/github/resource_github_team_membership.go index e0a296e657..52211bf868 100644 --- a/github/resource_github_team_membership.go +++ b/github/resource_github_team_membership.go @@ -13,10 +13,11 @@ import ( func resourceGithubTeamMembership() *schema.Resource { return &schema.Resource{ - Create: resourceGithubTeamMembershipCreateOrUpdate, - Read: resourceGithubTeamMembershipRead, - Update: resourceGithubTeamMembershipCreateOrUpdate, - Delete: resourceGithubTeamMembershipDelete, + Description: "Manages the membership of a user in a team.", + Create: resourceGithubTeamMembershipCreateOrUpdate, + Read: resourceGithubTeamMembershipRead, + Update: resourceGithubTeamMembershipCreateOrUpdate, + Delete: resourceGithubTeamMembershipDelete, Importer: &schema.ResourceImporter{ State: func(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { teamIdString, username, err := parseTwoPartID(d.Id(), "team_id", "username") @@ -56,8 +57,9 @@ func resourceGithubTeamMembership() *schema.Resource { ValidateDiagFunc: validateValueFunc([]string{"member", "maintainer"}), }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the team membership.", }, }, } diff --git a/github/resource_github_team_membership_test.go b/github/resource_github_team_membership_test.go index d2248d8816..098c10dfd8 100644 --- a/github/resource_github_team_membership_test.go +++ b/github/resource_github_team_membership_test.go @@ -21,7 +21,7 @@ func TestAccGithubTeamMembership(t *testing.T) { ctx := t.Context() var membership github.Membership - randString := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) + randString := acctest.RandString(10) resource.Test(t, resource.TestCase{ PreCheck: func() { skipUnlessHasOrgs(t) }, @@ -57,7 +57,7 @@ func TestAccGithubTeamMembership(t *testing.T) { var otherMembership github.Membership rn := "github_team_membership.test_team_membership" - randString := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) + randString := acctest.RandString(10) otherCase := flipUsernameCase(testAccConf.testOrgUser) diff --git a/github/resource_github_team_repository.go b/github/resource_github_team_repository.go index fa912b7de4..2ffa386d9b 100644 --- a/github/resource_github_team_repository.go +++ b/github/resource_github_team_repository.go @@ -14,10 +14,11 @@ import ( func resourceGithubTeamRepository() *schema.Resource { return &schema.Resource{ - Create: resourceGithubTeamRepositoryCreate, - Read: resourceGithubTeamRepositoryRead, - Update: resourceGithubTeamRepositoryUpdate, - Delete: resourceGithubTeamRepositoryDelete, + Description: "Manages a team's access to a repository.", + Create: resourceGithubTeamRepositoryCreate, + Read: resourceGithubTeamRepositoryRead, + Update: resourceGithubTeamRepositoryUpdate, + Delete: resourceGithubTeamRepositoryDelete, Importer: &schema.ResourceImporter{ State: func(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { teamIdString, username, err := parseTwoPartID(d.Id(), "team_id", "username") @@ -55,8 +56,9 @@ func resourceGithubTeamRepository() *schema.Resource { Description: "The permissions of team members regarding the repository. Must be one of 'pull', 'triage', 'push', 'maintain', 'admin' or the name of an existing custom repository role within the organisation.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the team repository association.", }, }, } diff --git a/github/resource_github_team_repository_test.go b/github/resource_github_team_repository_test.go index 2c3c9ef597..694266e5d6 100644 --- a/github/resource_github_team_repository_test.go +++ b/github/resource_github_team_repository_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubTeamRepository(t *testing.T) { t.Run("manages team permissions to a repository", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-repo-%s", testResourcePrefix, randomID) repoName := fmt.Sprintf("%srepo-team-repo-%s", testResourcePrefix, randomID) @@ -102,7 +102,7 @@ func TestAccGithubTeamRepository(t *testing.T) { }) t.Run("accepts both team slug and team ID for `team_id`", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-repo-slug-%s", testResourcePrefix, randomID) repoName := fmt.Sprintf("%srepo-team-repo-slug-%s", testResourcePrefix, randomID) @@ -147,7 +147,7 @@ func TestAccGithubTeamRepository(t *testing.T) { } func TestAccGithubTeamRepositoryArchivedRepo(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-archive-%s", testResourcePrefix, randomID) repoName := fmt.Sprintf("%srepo-team-archive-%s", testResourcePrefix, randomID) diff --git a/github/resource_github_team_settings.go b/github/resource_github_team_settings.go index 38841d3e80..cadb79be67 100644 --- a/github/resource_github_team_settings.go +++ b/github/resource_github_team_settings.go @@ -12,10 +12,11 @@ import ( func resourceGithubTeamSettings() *schema.Resource { return &schema.Resource{ - Create: resourceGithubTeamSettingsCreate, - Read: resourceGithubTeamSettingsRead, - Update: resourceGithubTeamSettingsUpdate, - Delete: resourceGithubTeamSettingsDelete, + Description: "Manages settings for a team.", + Create: resourceGithubTeamSettingsCreate, + Read: resourceGithubTeamSettingsRead, + Update: resourceGithubTeamSettingsUpdate, + Delete: resourceGithubTeamSettingsDelete, Importer: &schema.ResourceImporter{ State: resourceGithubTeamSettingsImport, }, diff --git a/github/resource_github_team_settings_test.go b/github/resource_github_team_settings_test.go index 09b46a0711..7db9459577 100644 --- a/github/resource_github_team_settings_test.go +++ b/github/resource_github_team_settings_test.go @@ -12,7 +12,7 @@ import ( func TestAccGithubTeamSettings(t *testing.T) { t.Run("manages team settings can use team_id id and slug", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-settings-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { @@ -48,7 +48,7 @@ func TestAccGithubTeamSettings(t *testing.T) { }) t.Run("manages team code review settings", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-settings-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { @@ -124,7 +124,7 @@ func TestAccGithubTeamSettings(t *testing.T) { }) t.Run("cannot manage team code review settings if disabled", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-settings-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { diff --git a/github/resource_github_team_sync_group_mapping.go b/github/resource_github_team_sync_group_mapping.go index 53d7363bf3..ec3f907f4d 100644 --- a/github/resource_github_team_sync_group_mapping.go +++ b/github/resource_github_team_sync_group_mapping.go @@ -13,10 +13,11 @@ import ( func resourceGithubTeamSyncGroupMapping() *schema.Resource { return &schema.Resource{ - Create: resourceGithubTeamSyncGroupMappingCreate, - Read: resourceGithubTeamSyncGroupMappingRead, - Update: resourceGithubTeamSyncGroupMappingUpdate, - Delete: resourceGithubTeamSyncGroupMappingDelete, + Description: "Manages the connection between a team and an identity provider group.", + Create: resourceGithubTeamSyncGroupMappingCreate, + Read: resourceGithubTeamSyncGroupMappingRead, + Update: resourceGithubTeamSyncGroupMappingUpdate, + Delete: resourceGithubTeamSyncGroupMappingDelete, Importer: &schema.ResourceImporter{ State: func(d *schema.ResourceData, meta any) ([]*schema.ResourceData, error) { if err := d.Set("team_slug", d.Id()); err != nil { @@ -59,8 +60,9 @@ func resourceGithubTeamSyncGroupMapping() *schema.Resource { }, }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the team sync group mapping.", }, }, } diff --git a/github/resource_github_team_sync_group_mapping_test.go b/github/resource_github_team_sync_group_mapping_test.go index 51ff3e5338..d7f731d1da 100644 --- a/github/resource_github_team_sync_group_mapping_test.go +++ b/github/resource_github_team_sync_group_mapping_test.go @@ -14,7 +14,7 @@ import ( func TestAccGithubTeamSyncGroupMapping_basic(t *testing.T) { t.Run("creates a team sync group mapping", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-sync-%s", testResourcePrefix, randomID) rn := "github_team_sync_group_mapping.test_mapping" @@ -46,7 +46,7 @@ func TestAccGithubTeamSyncGroupMapping_basic(t *testing.T) { }) t.Run("creates a team sync group mapping and then deletes it", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-sync-%s", testResourcePrefix, randomID) rn := "github_team_sync_group_mapping.test_mapping" @@ -67,7 +67,7 @@ func TestAccGithubTeamSyncGroupMapping_basic(t *testing.T) { }) t.Run("creates a team sync group mapping and then updates it", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-sync-%s", testResourcePrefix, randomID) description := "tf-acc-group-description-update" rn := "github_team_sync_group_mapping.test_mapping" @@ -112,7 +112,7 @@ func TestAccGithubTeamSyncGroupMapping_basic(t *testing.T) { }) t.Run("creates empty team sync group mapping", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-sync-%s", testResourcePrefix, randomID) rn := "github_team_sync_group_mapping.test_mapping" diff --git a/github/resource_github_team_test.go b/github/resource_github_team_test.go index 42e3cc4f5d..c28557acb1 100644 --- a/github/resource_github_team_test.go +++ b/github/resource_github_team_test.go @@ -10,7 +10,7 @@ import ( func TestAccGithubTeam(t *testing.T) { t.Run("creates a team configured with defaults", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { @@ -35,7 +35,7 @@ resource "github_team" "test" { }) t.Run("creates a team configured with alternatives", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testResourceName := fmt.Sprintf("%steam-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { @@ -62,7 +62,7 @@ resource "github_team" "test" { }) t.Run("creates a hierarchy of teams", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) team01Name := fmt.Sprintf("%steam-hier01-%s", testResourcePrefix, randomID) team02Name := fmt.Sprintf("%steam-hier02-%s", testResourcePrefix, randomID) team03Name := fmt.Sprintf("%steam-hier03-%s", testResourcePrefix, randomID) @@ -139,7 +139,7 @@ resource "github_team" "test" { }) t.Run("creates a team and removes the default maintainer", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-no-maint-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` resource "github_team" "test" { @@ -163,7 +163,7 @@ resource "github_team" "test" { }) t.Run("updates_slug", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) teamName := fmt.Sprintf("%steam-slug-%s", testResourcePrefix, randomID) teamNameUpdated := fmt.Sprintf("%s-updated", teamName) config := ` diff --git a/github/resource_github_user_gpg_key.go b/github/resource_github_user_gpg_key.go index cc6c2d21b8..657d72ee6e 100644 --- a/github/resource_github_user_gpg_key.go +++ b/github/resource_github_user_gpg_key.go @@ -13,9 +13,13 @@ import ( func resourceGithubUserGpgKey() *schema.Resource { return &schema.Resource{ - Create: resourceGithubUserGpgKeyCreate, - Read: resourceGithubUserGpgKeyRead, - Delete: resourceGithubUserGpgKeyDelete, + Description: "Manages a GPG key for the authenticated user.", + Create: resourceGithubUserGpgKeyCreate, + Read: resourceGithubUserGpgKeyRead, + Delete: resourceGithubUserGpgKeyDelete, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, Schema: map[string]*schema.Schema{ "armored_public_key": { @@ -30,8 +34,9 @@ func resourceGithubUserGpgKey() *schema.Resource { Description: "The key ID of the GPG key.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the GPG key.", }, }, } diff --git a/github/resource_github_user_invitation_accepter.go b/github/resource_github_user_invitation_accepter.go index 7981cd7c44..d2b301b2e8 100644 --- a/github/resource_github_user_invitation_accepter.go +++ b/github/resource_github_user_invitation_accepter.go @@ -10,10 +10,12 @@ import ( ) func resourceGithubUserInvitationAccepter() *schema.Resource { + // lintignore:XR002 return &schema.Resource{ - Create: resourceGithubUserInvitationAccepterCreate, - Read: schema.Noop, // Nothing to read as invitation is removed after it's accepted - Delete: schema.Noop, // Nothing to remove as invitation is removed after it's accepted + Description: "Accepts a repository invitation for the authenticated user.", + Create: resourceGithubUserInvitationAccepterCreate, + Read: schema.Noop, // Nothing to read as invitation is removed after it's accepted + Delete: schema.Noop, // Nothing to remove as invitation is removed after it's accepted Schema: map[string]*schema.Schema{ "invitation_id": { diff --git a/github/resource_github_user_ssh_key.go b/github/resource_github_user_ssh_key.go index 681a68220f..7dbdfc62f9 100644 --- a/github/resource_github_user_ssh_key.go +++ b/github/resource_github_user_ssh_key.go @@ -14,9 +14,10 @@ import ( func resourceGithubUserSshKey() *schema.Resource { return &schema.Resource{ - Create: resourceGithubUserSshKeyCreate, - Read: resourceGithubUserSshKeyRead, - Delete: resourceGithubUserSshKeyDelete, + Description: "Manages an SSH key for the authenticated user.", + Create: resourceGithubUserSshKeyCreate, + Read: resourceGithubUserSshKeyRead, + Delete: resourceGithubUserSshKeyDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -44,8 +45,9 @@ func resourceGithubUserSshKey() *schema.Resource { Description: "The URL of the SSH key.", }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the SSH key.", }, }, } diff --git a/github/resource_github_user_ssh_key_test.go b/github/resource_github_user_ssh_key_test.go index f21ac61239..4ced06a707 100644 --- a/github/resource_github_user_ssh_key_test.go +++ b/github/resource_github_user_ssh_key_test.go @@ -15,7 +15,7 @@ import ( func TestAccGithubUserSshKey(t *testing.T) { t.Run("creates and destroys a user SSH key without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testKey := newTestKey() config := fmt.Sprintf(` resource "github_user_ssh_key" "test" { @@ -52,7 +52,7 @@ func TestAccGithubUserSshKey(t *testing.T) { }) t.Run("imports an individual account SSH key without error", func(t *testing.T) { - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) testKey := newTestKey() config := fmt.Sprintf(` resource "github_user_ssh_key" "test" { diff --git a/github/resource_github_workflow_repository_permissions.go b/github/resource_github_workflow_repository_permissions.go index ca35e34183..82b8b932bc 100644 --- a/github/resource_github_workflow_repository_permissions.go +++ b/github/resource_github_workflow_repository_permissions.go @@ -10,10 +10,11 @@ import ( func resourceGithubWorkflowRepositoryPermissions() *schema.Resource { return &schema.Resource{ - Create: resourceGithubWorkflowRepositoryPermissionsCreateOrUpdate, - Read: resourceGithubWorkflowRepositoryPermissionsRead, - Update: resourceGithubWorkflowRepositoryPermissionsCreateOrUpdate, - Delete: resourceGithubWorkflowRepositoryPermissionsDelete, + Description: "Manages the default workflow permissions and fork pull request settings for a repository.", + Create: resourceGithubWorkflowRepositoryPermissionsCreateOrUpdate, + Read: resourceGithubWorkflowRepositoryPermissionsRead, + Update: resourceGithubWorkflowRepositoryPermissionsCreateOrUpdate, + Delete: resourceGithubWorkflowRepositoryPermissionsDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, diff --git a/github/resource_github_workflow_repository_permissions_test.go b/github/resource_github_workflow_repository_permissions_test.go index 2ecbff09c7..5bbd98f6c0 100644 --- a/github/resource_github_workflow_repository_permissions_test.go +++ b/github/resource_github_workflow_repository_permissions_test.go @@ -11,7 +11,7 @@ import ( func TestAccGithubWorkflowRepositoryPermissions(t *testing.T) { t.Run("test setting of basic workflow repository permissions", func(t *testing.T) { defaultWorkflowPermissions := "read" - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-workflow-perms-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` @@ -49,7 +49,7 @@ func TestAccGithubWorkflowRepositoryPermissions(t *testing.T) { defaultWorkflowPermissions := "read" canApprovePullRequestReviews := "true" - randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + randomID := acctest.RandString(5) repoName := fmt.Sprintf("%srepo-workflow-perms-%s", testResourcePrefix, randomID) config := fmt.Sprintf(` diff --git a/github/resource_organization_block.go b/github/resource_organization_block.go index 013e49d1dc..cbce836525 100644 --- a/github/resource_organization_block.go +++ b/github/resource_organization_block.go @@ -12,9 +12,10 @@ import ( func resourceOrganizationBlock() *schema.Resource { return &schema.Resource{ - Create: resourceOrganizationBlockCreate, - Read: resourceOrganizationBlockRead, - Delete: resourceOrganizationBlockDelete, + Description: "Manages blocking a user from an organization.", + Create: resourceOrganizationBlockCreate, + Read: resourceOrganizationBlockRead, + Delete: resourceOrganizationBlockDelete, Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -28,8 +29,9 @@ func resourceOrganizationBlock() *schema.Resource { }, "etag": { - Type: schema.TypeString, - Computed: true, + Type: schema.TypeString, + Computed: true, + Description: "An etag representing the organization block.", }, }, } diff --git a/github/transport.go b/github/transport.go index 8b445b7a37..a6537b79f2 100644 --- a/github/transport.go +++ b/github/transport.go @@ -283,7 +283,7 @@ func (t *RetryTransport) RoundTrip(req *http.Request) (*http.Response, error) { return resp, err } - time.Sleep(t.retryDelay) + time.Sleep(t.retryDelay) // lintignore:R018 } return resp, err diff --git a/github/util_v4_repository_test.go b/github/util_v4_repository_test.go index 7e0a1daf40..9e91bda0a2 100644 --- a/github/util_v4_repository_test.go +++ b/github/util_v4_repository_test.go @@ -117,15 +117,15 @@ func TestGetRepositoryIDPositiveMatches(t *testing.T) { responses := template.Must(template.New("node_match").Parse(nodeMatchTmpl)) _, err := responses.New("node_no_match").Parse(nodeNoMatchTmpl) if err != nil { - panic(err) + t.Fatal(err) } _, err = responses.New("repo_match").Parse(repoMatchTmpl) if err != nil { - panic(err) + t.Fatal(err) } _, err = responses.New("repo_no_match").Parse(repoNoMatchTmpl) if err != nil { - panic(err) + t.Fatal(err) } mux := http.NewServeMux() @@ -206,7 +206,7 @@ func (l localRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) func mustRead(r io.Reader) string { b, err := io.ReadAll(r) if err != nil { - panic(err) + panic(err) // lintignore:R009 } return string(b) } @@ -214,6 +214,6 @@ func mustRead(r io.Reader) string { func mustWrite(w io.Writer, s string) { _, err := io.WriteString(w, s) if err != nil { - panic(err) + panic(err) // lintignore:R009 } }