From f6add3ed515b2eb96edab64d01d823b303a225d1 Mon Sep 17 00:00:00 2001 From: tf-release-bot Date: Tue, 1 Dec 2020 13:45:54 +0000 Subject: [PATCH 01/45] v4.1.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87ef47f622..0f46a5b79c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 4.1.0 (Unreleased) +## 4.1.0 (December 01, 2020) ENHANCEMENTS: From 65e8c3ff59ef315c9dcfc59118f55bbe0d4996e0 Mon Sep 17 00:00:00 2001 From: Polygens Date: Tue, 8 Dec 2020 20:06:12 +0100 Subject: [PATCH 02/45] Fix unable to resolve node id for branch_protection (#610) * Don't check node id for length * Check if node id is valid base 64 Co-authored-by: Willem Gillis --- github/util_v4_repository.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/github/util_v4_repository.go b/github/util_v4_repository.go index 494e5fadea..66a1be4043 100644 --- a/github/util_v4_repository.go +++ b/github/util_v4_repository.go @@ -2,6 +2,7 @@ package github import ( "context" + "encoding/base64" "github.com/shurcooL/githubv4" ) @@ -38,8 +39,9 @@ func getRepositoryID(name string, meta interface{}) (githubv4.ID, error) { } func repositoryNodeIDExists(name string, meta interface{}) (bool, error) { - // Quick check for node ID length - if len(name) != 32 { + // Check if the name is a base 64 encoded node ID + _, err := base64.StdEncoding.DecodeString(name) + if err != nil { return false, nil } @@ -54,7 +56,7 @@ func repositoryNodeIDExists(name string, meta interface{}) (bool, error) { } ctx := context.Background() client := meta.(*Owner).v4client - err := client.Query(ctx, &query, variables) + err = client.Query(ctx, &query, variables) if err != nil { return false, err } From 925082e0a7da5cf55b2fc1ab538e8051f54d3bed Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Thu, 10 Dec 2020 08:29:09 -0500 Subject: [PATCH 03/45] temporarily disable PR acceptance testing these jobs all fail and are confusing to contributors when launched from a PR raised by a fork. there are ways to get around this, but will defer until the repository is transferred. disabling for now. --- .github/workflows/dotcom-acceptance-tests.yml | 5 +++-- .github/workflows/ghes-acceptance-tests.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotcom-acceptance-tests.yml b/.github/workflows/dotcom-acceptance-tests.yml index 218a7ddd44..2c8e418ad7 100644 --- a/.github/workflows/dotcom-acceptance-tests.yml +++ b/.github/workflows/dotcom-acceptance-tests.yml @@ -1,8 +1,9 @@ name: Dotcom Acceptance Tests on: - pull_request: - types: [opened, synchronize, reopened] + push: + branches: + - test/** jobs: diff --git a/.github/workflows/ghes-acceptance-tests.yml b/.github/workflows/ghes-acceptance-tests.yml index 4b9d23363f..3c80fcee19 100644 --- a/.github/workflows/ghes-acceptance-tests.yml +++ b/.github/workflows/ghes-acceptance-tests.yml @@ -1,8 +1,9 @@ name: GHES Acceptance Tests on: - pull_request: - types: [opened, synchronize, reopened] + push: + branches: + - test/** jobs: From 44a0b0d6ca45b3703b6349972640199621046662 Mon Sep 17 00:00:00 2001 From: Ben Abrams Date: Fri, 18 Dec 2020 09:06:42 -0800 Subject: [PATCH 04/45] remove `ForceNew` on `template*` as they are concerns only at creation time (#609) There are a number of resources that have been marked as `ForceNew: true` out of a desire in "correctness" by those that do not actually understand how these resources are used in the real world and damage that can be done. No one wants to blow up a repository to change something like this, if they need to there is a mechanism built into terraform called [taint](https://www.terraform.io/docs/commands/taint.html). While there are some things that make sense for using `ForceNew` a repository for source control on properties that the API will ignore outside of creation is not one of them. Signed-off-by: Ben Abrams --- github/resource_github_repository.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/github/resource_github_repository.go b/github/resource_github_repository.go index 8f06df695d..275d945eb0 100644 --- a/github/resource_github_repository.go +++ b/github/resource_github_repository.go @@ -106,13 +106,11 @@ func resourceGithubRepository() *schema.Resource { }, "license_template": { Type: schema.TypeString, - Optional: true, - ForceNew: true, + Optional: true }, "gitignore_template": { Type: schema.TypeString, Optional: true, - ForceNew: true, }, "archived": { Type: schema.TypeBool, @@ -167,7 +165,6 @@ func resourceGithubRepository() *schema.Resource { "template": { Type: schema.TypeList, Optional: true, - ForceNew: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ From 56470d7eab8eb1ce77e1a8a5a87dcc107ced26f2 Mon Sep 17 00:00:00 2001 From: Patrick Marabeas Date: Sat, 19 Dec 2020 04:41:18 +1100 Subject: [PATCH 05/45] Add diff suppression function to the branch protection resource (#614) Adding a diff suppression function to the branch protection resource to ignore the strict status check field if no contexts have been specified. This resolves the issue with the GraphQL API returning a strict status check value of "true" by default, regardless of contexts being set or not. --- github/resource_github_branch_protection.go | 1 + github/util_v4_branch_protection.go | 25 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/github/resource_github_branch_protection.go b/github/resource_github_branch_protection.go index f5b784fe62..d9f7849b5b 100644 --- a/github/resource_github_branch_protection.go +++ b/github/resource_github_branch_protection.go @@ -68,6 +68,7 @@ func resourceGithubBranchProtection() *schema.Resource { PROTECTION_REQUIRES_STATUS_CHECKS: { Type: schema.TypeList, Optional: true, + DiffSuppressFunc: statusChecksDiffSuppression, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ PROTECTION_REQUIRES_STRICT_STATUS_CHECKS: { diff --git a/github/util_v4_branch_protection.go b/github/util_v4_branch_protection.go index 55e7fed398..3dab5a4e3a 100644 --- a/github/util_v4_branch_protection.go +++ b/github/util_v4_branch_protection.go @@ -274,3 +274,28 @@ func getBranchProtectionID(name string, pattern string, meta interface{}) (githu return id, nil } + +func statusChecksDiffSuppression(k, old, new string, d *schema.ResourceData) bool { + data := BranchProtectionResourceData{} + checks := false + + if v, ok := d.GetOk(PROTECTION_REQUIRES_STATUS_CHECKS); ok { + vL := v.([]interface{}) + for _, v := range vL { + if v == nil { + break + } + + m := v.(map[string]interface{}) + data.RequiredStatusCheckContexts = expandNestedSet(m, PROTECTION_REQUIRED_STATUS_CHECK_CONTEXTS) + if len(data.RequiredStatusCheckContexts) > 0 { + checks = true + } + } + } + + if old == "0" && new == "1" && !checks { + return true + } + return false +} From 81cbb1a7c16be8f176d65ac6d14b8c971854f68f Mon Sep 17 00:00:00 2001 From: Patrick Marabeas Date: Sat, 19 Dec 2020 04:41:38 +1100 Subject: [PATCH 06/45] Add Apps to actor types in branch protection (#615) Adding Github Apps to actor types in the branch protection resource. NOTE: Apps as an actor type is only available in push restrictions. --- github/util_v4_branch_protection.go | 34 ++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/github/util_v4_branch_protection.go b/github/util_v4_branch_protection.go index 3dab5a4e3a..93bb593585 100644 --- a/github/util_v4_branch_protection.go +++ b/github/util_v4_branch_protection.go @@ -13,23 +13,31 @@ type Actor struct { Name githubv4.String } -type ActorTypes struct { +type DismissalActorTypes struct { Actor struct { Team Actor `graphql:"... on Team"` User Actor `graphql:"... on User"` } } +type PushActorTypes struct { + Actor struct { + App Actor `graphql:"... on App"` + Team Actor `graphql:"... on Team"` + User Actor `graphql:"... on User"` + } +} + type BranchProtectionRule struct { Repository struct { ID githubv4.String Name githubv4.String } PushAllowances struct { - Nodes []ActorTypes + Nodes []PushActorTypes } `graphql:"pushAllowances(first: 100)"` ReviewDismissalAllowances struct { - Nodes []ActorTypes + Nodes []DismissalActorTypes } `graphql:"reviewDismissalAllowances(first: 100)"` DismissesStaleReviews githubv4.Boolean ID githubv4.ID @@ -163,7 +171,21 @@ func branchProtectionResourceData(d *schema.ResourceData, meta interface{}) (Bra return data, nil } -func setActorIDs(actors []ActorTypes) []string { +func setDismissalActorIDs(actors []DismissalActorTypes) []string { + pushActors := make([]string, 0, len(actors)) + for _, a := range actors { + if a.Actor.Team != (Actor{}) { + pushActors = append(pushActors, a.Actor.Team.ID.(string)) + } + if a.Actor.User != (Actor{}) { + pushActors = append(pushActors, a.Actor.Team.ID.(string)) + } + } + + return pushActors +} + +func setPushActorIDs(actors []PushActorTypes) []string { pushActors := make([]string, 0, len(actors)) for _, a := range actors { if a.Actor.Team != (Actor{}) { @@ -183,7 +205,7 @@ func setApprovingReviews(protection BranchProtectionRule) interface{} { } dismissalAllowances := protection.ReviewDismissalAllowances.Nodes - dismissalActors := setActorIDs(dismissalAllowances) + dismissalActors := setDismissalActorIDs(dismissalAllowances) approvalReviews := []interface{}{ map[string]interface{}{ PROTECTION_REQUIRED_APPROVING_REVIEW_COUNT: protection.RequiredApprovingReviewCount, @@ -216,7 +238,7 @@ func setPushes(protection BranchProtectionRule) []string { return nil } pushAllowances := protection.PushAllowances.Nodes - pushActors := setActorIDs(pushAllowances) + pushActors := setPushActorIDs(pushAllowances) return pushActors } From 8927341466988de37a3036b56b14741fc01b7851 Mon Sep 17 00:00:00 2001 From: Francois BAYART Date: Fri, 18 Dec 2020 18:42:28 +0100 Subject: [PATCH 07/45] Added `allowsDeletions`and `allowsForcePushes`settings (#623) * Added `allowsDeletions`and `allowsForcePushes`settings https://developer.github.com/v4/changelog/2020-11-13-schema-changes/ (#1) * complete documentation * update module github.com/shurcooL/githubv4 with `go get github.com/shurcooL/githubv4` * vendor latest githubv4 * add test for deletions and force pushes Co-authored-by: Jeremy Udit --- github/resource_github_branch_protection.go | 24 + .../resource_github_branch_protection_test.go | 59 ++ github/util_v4_branch_protection.go | 12 + github/util_v4_consts.go | 2 + go.mod | 4 +- go.sum | 2 + vendor/github.com/shurcooL/githubv4/README.md | 21 +- vendor/github.com/shurcooL/githubv4/doc.go | 5 +- vendor/github.com/shurcooL/githubv4/enum.go | 430 ++++++++------ vendor/github.com/shurcooL/githubv4/input.go | 552 ++++++++++++++---- vendor/modules.txt | 2 +- .../docs/r/branch_protection.html.markdown | 7 +- 12 files changed, 837 insertions(+), 283 deletions(-) diff --git a/github/resource_github_branch_protection.go b/github/resource_github_branch_protection.go index d9f7849b5b..b98dddea1c 100644 --- a/github/resource_github_branch_protection.go +++ b/github/resource_github_branch_protection.go @@ -28,6 +28,16 @@ func resourceGithubBranchProtection() *schema.Resource { Required: true, Description: "", }, + PROTECTION_ALLOWS_DELETIONS: { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + PROTECTION_ALLOWS_FORCE_PUSHES: { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, PROTECTION_IS_ADMIN_ENFORCED: { Type: schema.TypeBool, Optional: true, @@ -122,6 +132,8 @@ func resourceGithubBranchProtectionCreate(d *schema.ResourceData, meta interface return err } input := githubv4.CreateBranchProtectionRuleInput{ + AllowsDeletions: githubv4.NewBoolean(githubv4.Boolean(data.AllowsDeletions)), + AllowsForcePushes: githubv4.NewBoolean(githubv4.Boolean(data.AllowsForcePushes)), DismissesStaleReviews: githubv4.NewBoolean(githubv4.Boolean(data.DismissesStaleReviews)), IsAdminEnforced: githubv4.NewBoolean(githubv4.Boolean(data.IsAdminEnforced)), Pattern: githubv4.String(data.Pattern), @@ -181,6 +193,16 @@ func resourceGithubBranchProtectionRead(d *schema.ResourceData, meta interface{} log.Printf("[WARN] 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) + if err != nil { + log.Printf("[WARN] 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) + if err != nil { + log.Printf("[WARN] 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) if err != nil { log.Printf("[WARN] Problem setting '%s' in %s %s branch protection (%s)", PROTECTION_IS_ADMIN_ENFORCED, protection.Repository.Name, protection.Pattern, d.Id()) @@ -226,6 +248,8 @@ func resourceGithubBranchProtectionUpdate(d *schema.ResourceData, meta interface } input := githubv4.UpdateBranchProtectionRuleInput{ BranchProtectionRuleID: d.Id(), + AllowsDeletions: githubv4.NewBoolean(githubv4.Boolean(data.AllowsDeletions)), + AllowsForcePushes: githubv4.NewBoolean(githubv4.Boolean(data.AllowsForcePushes)), DismissesStaleReviews: githubv4.NewBoolean(githubv4.Boolean(data.DismissesStaleReviews)), IsAdminEnforced: githubv4.NewBoolean(githubv4.Boolean(data.IsAdminEnforced)), Pattern: githubv4.NewString(githubv4.String(data.Pattern)), diff --git a/github/resource_github_branch_protection_test.go b/github/resource_github_branch_protection_test.go index 7309b1f45c..f6cbc1ed29 100644 --- a/github/resource_github_branch_protection_test.go +++ b/github/resource_github_branch_protection_test.go @@ -261,6 +261,65 @@ func TestAccGithubBranchProtection(t *testing.T) { }) }) + + t.Run("configures force pushes and deletions", func(t *testing.T) { + + config := fmt.Sprintf(` + resource "github_repository" "test" { + name = "tf-acc-test-%s" + auto_init = true + } + + data "github_user" "test" { + username = "%s" + } + + resource "github_branch_protection" "test" { + + repository_id = github_repository.test.name + pattern = "main" + allows_deletions = true + allows_force_pushes = true + + } + `, randomID, testOwnerFunc()) + + check := resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "github_branch_protection.test", "allows_deletions", "true", + ), + resource.TestCheckResourceAttr( + "github_branch_protection.test", "allows_force_pushes", "true", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + }) + } func branchProtectionImportStateIdFunc(repo, pattern string) resource.ImportStateIdFunc { diff --git a/github/util_v4_branch_protection.go b/github/util_v4_branch_protection.go index 93bb593585..ad2587098b 100644 --- a/github/util_v4_branch_protection.go +++ b/github/util_v4_branch_protection.go @@ -39,6 +39,8 @@ type BranchProtectionRule struct { ReviewDismissalAllowances struct { Nodes []DismissalActorTypes } `graphql:"reviewDismissalAllowances(first: 100)"` + AllowsDeletions githubv4.Boolean + AllowsForcePushes githubv4.Boolean DismissesStaleReviews githubv4.Boolean ID githubv4.ID IsAdminEnforced githubv4.Boolean @@ -55,6 +57,8 @@ type BranchProtectionRule struct { } type BranchProtectionResourceData struct { + AllowsDeletions bool + AllowsForcePushes bool BranchProtectionRuleID string DismissesStaleReviews bool IsAdminEnforced bool @@ -88,6 +92,14 @@ func branchProtectionResourceData(d *schema.ResourceData, meta interface{}) (Bra data.Pattern = v.(string) } + if v, ok := d.GetOk(PROTECTION_ALLOWS_DELETIONS); ok { + data.AllowsDeletions = v.(bool) + } + + if v, ok := d.GetOk(PROTECTION_ALLOWS_FORCE_PUSHES); ok { + data.AllowsForcePushes = v.(bool) + } + if v, ok := d.GetOk(PROTECTION_IS_ADMIN_ENFORCED); ok { data.IsAdminEnforced = v.(bool) } diff --git a/github/util_v4_consts.go b/github/util_v4_consts.go index adfe74585c..fc8a967b2f 100644 --- a/github/util_v4_consts.go +++ b/github/util_v4_consts.go @@ -1,6 +1,8 @@ package github const ( + PROTECTION_ALLOWS_DELETIONS = "allows_deletions" + PROTECTION_ALLOWS_FORCE_PUSHES = "allows_force_pushes" PROTECTION_DISMISSES_STALE_REVIEWS = "dismiss_stale_reviews" PROTECTION_IS_ADMIN_ENFORCED = "enforce_admins" PROTECTION_PATTERN = "pattern" diff --git a/go.mod b/go.mod index 7598170951..39d945478e 100644 --- a/go.mod +++ b/go.mod @@ -5,12 +5,12 @@ go 1.13 require ( github.com/client9/misspell v0.3.4 github.com/golangci/golangci-lint v1.25.1 - github.com/google/go-github/v31 v31.0.0 + github.com/google/go-github/v31 v31.0.0 // indirect github.com/google/go-github/v32 v32.1.0 github.com/hashicorp/terraform v0.12.24 github.com/hashicorp/terraform-plugin-sdk v1.7.0 github.com/kylelemons/godebug v1.1.0 // indirect - github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0 + github.com/shurcooL/githubv4 v0.0.0-20201206200315-234843c633fa github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d diff --git a/go.sum b/go.sum index 0c7bf1d69d..97533d08f2 100644 --- a/go.sum +++ b/go.sum @@ -480,6 +480,8 @@ github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lz github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0 h1:T9uus1QvcPgeLShS30YOnnzk3r9Vvygp45muhlrufgY= github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= +github.com/shurcooL/githubv4 v0.0.0-20201206200315-234843c633fa h1:jozR3igKlnYCj9IVHOVump59bp07oIRoLQ/CcjMYIUA= +github.com/shurcooL/githubv4 v0.0.0-20201206200315-234843c633fa/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e h1:MZM7FHLqUHYI0Y/mQAt3d2aYa0SiNms/hFqC9qJYolM= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041 h1:llrF3Fs4018ePo4+G/HV/uQUqEI1HMDjCeOf2V6puPc= diff --git a/vendor/github.com/shurcooL/githubv4/README.md b/vendor/github.com/shurcooL/githubv4/README.md index 319a6428ab..8516d3bdc0 100644 --- a/vendor/github.com/shurcooL/githubv4/README.md +++ b/vendor/github.com/shurcooL/githubv4/README.md @@ -3,12 +3,10 @@ githubv4 [![Build Status](https://travis-ci.org/shurcooL/githubv4.svg?branch=master)](https://travis-ci.org/shurcooL/githubv4) [![GoDoc](https://godoc.org/github.com/shurcooL/githubv4?status.svg)](https://godoc.org/github.com/shurcooL/githubv4) -Package `githubv4` is a client library for accessing GitHub GraphQL API v4 (https://developer.github.com/v4/). +Package `githubv4` is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql). If you're looking for a client library for GitHub REST API v3, the recommended package is [`github.com/google/go-github/github`](https://godoc.org/github.com/google/go-github/github). -**Status:** In research and development. The API will change when opportunities for improvement are discovered; it is not yet frozen. - Focus ----- @@ -30,7 +28,7 @@ Usage ### Authentication -GitHub GraphQL API v4 [requires authentication](https://developer.github.com/v4/guides/forming-calls/#authenticating-with-graphql). The `githubv4` package does not directly handle authentication. Instead, when creating a new client, you're expected to pass an `http.Client` that performs authentication. The easiest and recommended way to do this is to use the [`golang.org/x/oauth2`](https://golang.org/x/oauth2) package. You'll need an OAuth token from GitHub (for example, a [personal API token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)) with the right scopes. Then: +GitHub GraphQL API v4 [requires authentication](https://docs.github.com/en/graphql/guides/forming-calls-with-graphql#authenticating-with-graphql). The `githubv4` package does not directly handle authentication. Instead, when creating a new client, you're expected to pass an `http.Client` that performs authentication. The easiest and recommended way to do this is to use the [`golang.org/x/oauth2`](https://golang.org/x/oauth2) package. You'll need an OAuth token from GitHub (for example, a [personal API token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)) with the right scopes. Then: ```Go import "golang.org/x/oauth2" @@ -46,9 +44,16 @@ func main() { } ``` +If you are using GitHub Enterprise, use [`githubv4.NewEnterpriseClient`](https://godoc.org/github.com/shurcooL/githubv4#NewEnterpriseClient): + +```Go +client := githubv4.NewEnterpriseClient(os.Getenv("GITHUB_ENDPOINT"), httpClient) +// Use client... +``` + ### Simple Query -To make a query, you need to define a Go type that corresponds to the GitHub GraphQL schema, and contains the fields you're interested in querying. You can look up the GitHub GraphQL schema at https://developer.github.com/v4/query/. +To make a query, you need to define a Go type that corresponds to the GitHub GraphQL schema, and contains the fields you're interested in querying. You can look up the GitHub GraphQL schema at https://docs.github.com/en/graphql/reference/queries. For example, to make the following GraphQL query: @@ -89,7 +94,7 @@ fmt.Println("CreatedAt:", query.Viewer.CreatedAt) ### Scalar Types -For each scalar in the GitHub GraphQL schema listed at https://developer.github.com/v4/scalar/, there is a corresponding Go type in package `githubv4`. +For each scalar in the GitHub GraphQL schema listed at https://docs.github.com/en/graphql/reference/scalars, there is a corresponding Go type in package `githubv4`. You can use these types when writing queries: @@ -127,7 +132,7 @@ var query struct { // Call client.Query() and use results in query... ``` -The [`DateTime`](https://developer.github.com/v4/scalar/datetime/) scalar is described as "an ISO-8601 encoded UTC date string". If you wanted to fetch in that form without parsing it into a `time.Time`, you can use the `string` type. For example, this would work: +The [`DateTime`](https://docs.github.com/en/graphql/reference/scalars#datetime) scalar is described as "an ISO-8601 encoded UTC date string". If you wanted to fetch in that form without parsing it into a `time.Time`, you can use the `string` type. For example, this would work: ```Go // import "html/template" @@ -336,7 +341,7 @@ for { } ``` -There is more than one way to perform pagination. Consider additional fields inside [`PageInfo`](https://developer.github.com/v4/object/pageinfo/) object. +There is more than one way to perform pagination. Consider additional fields inside [`PageInfo`](https://docs.github.com/en/graphql/reference/objects#pageinfo) object. ### Mutations diff --git a/vendor/github.com/shurcooL/githubv4/doc.go b/vendor/github.com/shurcooL/githubv4/doc.go index 0ce1a508a8..74fddc50ef 100644 --- a/vendor/github.com/shurcooL/githubv4/doc.go +++ b/vendor/github.com/shurcooL/githubv4/doc.go @@ -1,12 +1,9 @@ // Package githubv4 is a client library for accessing GitHub -// GraphQL API v4 (https://developer.github.com/v4/). +// GraphQL API v4 (https://docs.github.com/en/graphql). // // If you're looking for a client library for GitHub REST API v3, // the recommended package is github.com/google/go-github/github. // -// Status: In active early research and development. The API will change when -// opportunities for improvement are discovered; it is not yet frozen. -// // For now, see README for more details. package githubv4 // import "github.com/shurcooL/githubv4" diff --git a/vendor/github.com/shurcooL/githubv4/enum.go b/vendor/github.com/shurcooL/githubv4/enum.go index 46fbeb0da1..c8674a99cf 100644 --- a/vendor/github.com/shurcooL/githubv4/enum.go +++ b/vendor/github.com/shurcooL/githubv4/enum.go @@ -2,17 +2,6 @@ package githubv4 -// ActionExecutionCapabilitySetting represents the possible capabilities for action executions setting. -type ActionExecutionCapabilitySetting string - -// The possible capabilities for action executions setting. -const ( - ActionExecutionCapabilitySettingDisabled ActionExecutionCapabilitySetting = "DISABLED" // All action executions are disabled. - ActionExecutionCapabilitySettingAllActions ActionExecutionCapabilitySetting = "ALL_ACTIONS" // All action executions are enabled. - ActionExecutionCapabilitySettingLocalActionsOnly ActionExecutionCapabilitySetting = "LOCAL_ACTIONS_ONLY" // Only actions defined within the repo are allowed. - ActionExecutionCapabilitySettingNoPolicy ActionExecutionCapabilitySetting = "NO_POLICY" // Organization administrators action execution capabilities. -) - // AuditLogOrderField represents properties by which Audit Log connections can be ordered. type AuditLogOrderField string @@ -21,6 +10,52 @@ const ( AuditLogOrderFieldCreatedAt AuditLogOrderField = "CREATED_AT" // Order audit log entries by timestamp. ) +// CheckAnnotationLevel represents represents an annotation's information level. +type CheckAnnotationLevel string + +// Represents an annotation's information level. +const ( + CheckAnnotationLevelFailure CheckAnnotationLevel = "FAILURE" // An annotation indicating an inescapable error. + CheckAnnotationLevelNotice CheckAnnotationLevel = "NOTICE" // An annotation indicating some information. + CheckAnnotationLevelWarning CheckAnnotationLevel = "WARNING" // An annotation indicating an ignorable error. +) + +// CheckConclusionState represents the possible states for a check suite or run conclusion. +type CheckConclusionState string + +// The possible states for a check suite or run conclusion. +const ( + CheckConclusionStateActionRequired CheckConclusionState = "ACTION_REQUIRED" // The check suite or run requires action. + CheckConclusionStateTimedOut CheckConclusionState = "TIMED_OUT" // The check suite or run has timed out. + CheckConclusionStateCancelled CheckConclusionState = "CANCELLED" // The check suite or run has been cancelled. + CheckConclusionStateFailure CheckConclusionState = "FAILURE" // The check suite or run has failed. + CheckConclusionStateSuccess CheckConclusionState = "SUCCESS" // The check suite or run has succeeded. + CheckConclusionStateNeutral CheckConclusionState = "NEUTRAL" // The check suite or run was neutral. + CheckConclusionStateSkipped CheckConclusionState = "SKIPPED" // The check suite or run was skipped. + CheckConclusionStateStartupFailure CheckConclusionState = "STARTUP_FAILURE" // The check suite or run has failed at startup. + CheckConclusionStateStale CheckConclusionState = "STALE" // The check suite or run was marked stale by GitHub. Only GitHub can use this conclusion. +) + +// CheckRunType represents the possible types of check runs. +type CheckRunType string + +// The possible types of check runs. +const ( + CheckRunTypeAll CheckRunType = "ALL" // Every check run available. + CheckRunTypeLatest CheckRunType = "LATEST" // The latest check run. +) + +// CheckStatusState represents the possible states for a check suite or run status. +type CheckStatusState string + +// The possible states for a check suite or run status. +const ( + CheckStatusStateQueued CheckStatusState = "QUEUED" // The check suite or run has been queued. + CheckStatusStateInProgress CheckStatusState = "IN_PROGRESS" // The check suite or run is in progress. + CheckStatusStateCompleted CheckStatusState = "COMPLETED" // The check suite or run has been completed. + CheckStatusStateRequested CheckStatusState = "REQUESTED" // The check suite or run has been requested. +) + // CollaboratorAffiliation represents collaborators affiliation level with a subject. type CollaboratorAffiliation string @@ -38,6 +73,7 @@ type CommentAuthorAssociation string const ( CommentAuthorAssociationMember CommentAuthorAssociation = "MEMBER" // Author is a member of the organization that owns the repository. CommentAuthorAssociationOwner CommentAuthorAssociation = "OWNER" // Author is the owner of the repository. + CommentAuthorAssociationMannequin CommentAuthorAssociation = "MANNEQUIN" // Author is a placeholder for an unclaimed user. CommentAuthorAssociationCollaborator CommentAuthorAssociation = "COLLABORATOR" // Author has been invited to collaborate on the repository. CommentAuthorAssociationContributor CommentAuthorAssociation = "CONTRIBUTOR" // Author has previously committed to the repository. CommentAuthorAssociationFirstTimeContributor CommentAuthorAssociation = "FIRST_TIME_CONTRIBUTOR" // Author has not previously committed to the repository. @@ -68,14 +104,6 @@ const ( CommitContributionOrderFieldCommitCount CommitContributionOrderField = "COMMIT_COUNT" // Order commit contributions by how many commits they represent. ) -// ContributionOrderField represents properties by which contribution connections can be ordered. -type ContributionOrderField string - -// Properties by which contribution connections can be ordered. -const ( - ContributionOrderFieldOccurredAt ContributionOrderField = "OCCURRED_AT" // Order contributions by when they were made. -) - // DefaultRepositoryPermissionField represents the possible default permissions for repositories. type DefaultRepositoryPermissionField string @@ -109,6 +137,7 @@ const ( DeploymentStatePending DeploymentState = "PENDING" // The deployment is pending. DeploymentStateQueued DeploymentState = "QUEUED" // The deployment has queued. DeploymentStateInProgress DeploymentState = "IN_PROGRESS" // The deployment is in progress. + DeploymentStateWaiting DeploymentState = "WAITING" // The deployment is waiting. ) // DeploymentStatusState represents the possible states for a deployment status. @@ -125,6 +154,15 @@ const ( DeploymentStatusStateInProgress DeploymentStatusState = "IN_PROGRESS" // The deployment is in progress. ) +// DiffSide represents the possible sides of a diff. +type DiffSide string + +// The possible sides of a diff. +const ( + DiffSideLeft DiffSide = "LEFT" // The left side of the diff. + DiffSideRight DiffSide = "RIGHT" // The right side of the diff. +) + // EnterpriseAdministratorInvitationOrderField represents properties by which enterprise administrator invitation connections can be ordered. type EnterpriseAdministratorInvitationOrderField string @@ -203,25 +241,6 @@ const ( EnterpriseMembersCanMakePurchasesSettingValueDisabled EnterpriseMembersCanMakePurchasesSettingValue = "DISABLED" // The setting is disabled for organizations in the enterprise. ) -// EnterpriseMembershipType represents the possible values we have for filtering Platform::Objects::User#enterprises. -type EnterpriseMembershipType string - -// The possible values we have for filtering Platform::Objects::User#enterprises. -const ( - EnterpriseMembershipTypeAll EnterpriseMembershipType = "ALL" // Returns all enterprises in which the user is a member, admin, or billing manager. - EnterpriseMembershipTypeAdmin EnterpriseMembershipType = "ADMIN" // Returns all enterprises in which the user is an admin. - EnterpriseMembershipTypeBillingManager EnterpriseMembershipType = "BILLING_MANAGER" // Returns all enterprises in which the user is a billing manager. - EnterpriseMembershipTypeOrgMembership EnterpriseMembershipType = "ORG_MEMBERSHIP" // Returns all enterprises in which the user is a member of an org that is owned by the enterprise. -) - -// EnterpriseOrderField represents properties by which enterprise connections can be ordered. -type EnterpriseOrderField string - -// Properties by which enterprise connections can be ordered. -const ( - EnterpriseOrderFieldName EnterpriseOrderField = "NAME" // Order enterprises by name. -) - // EnterpriseServerInstallationOrderField represents properties by which Enterprise Server installation connections can be ordered. type EnterpriseServerInstallationOrderField string @@ -285,6 +304,16 @@ const ( EnterpriseUserDeploymentServer EnterpriseUserDeployment = "SERVER" // The user is part of a GitHub Enterprise Server deployment. ) +// FileViewedState represents the possible viewed states of a file . +type FileViewedState string + +// The possible viewed states of a file . +const ( + FileViewedStateDismissed FileViewedState = "DISMISSED" // The file has new changes since last viewed. + FileViewedStateViewed FileViewedState = "VIEWED" // The file has been marked as viewed. + FileViewedStateUnviewed FileViewedState = "UNVIEWED" // The file has not been marked as viewed. +) + // FundingPlatform represents the possible funding platforms for repository funding links. type FundingPlatform string @@ -356,6 +385,32 @@ const ( IdentityProviderConfigurationStateUnconfigured IdentityProviderConfigurationState = "UNCONFIGURED" // Authentication with an identity provider is not configured. ) +// IpAllowListEnabledSettingValue represents the possible values for the IP allow list enabled setting. +type IpAllowListEnabledSettingValue string + +// The possible values for the IP allow list enabled setting. +const ( + IpAllowListEnabledSettingValueEnabled IpAllowListEnabledSettingValue = "ENABLED" // The setting is enabled for the owner. + IpAllowListEnabledSettingValueDisabled IpAllowListEnabledSettingValue = "DISABLED" // The setting is disabled for the owner. +) + +// IpAllowListEntryOrderField represents properties by which IP allow list entry connections can be ordered. +type IpAllowListEntryOrderField string + +// Properties by which IP allow list entry connections can be ordered. +const ( + IpAllowListEntryOrderFieldCreatedAt IpAllowListEntryOrderField = "CREATED_AT" // Order IP allow list entries by creation time. + IpAllowListEntryOrderFieldAllowListValue IpAllowListEntryOrderField = "ALLOW_LIST_VALUE" // Order IP allow list entries by the allow list value. +) + +// IssueCommentOrderField represents properties by which issue comment connections can be ordered. +type IssueCommentOrderField string + +// Properties by which issue comment connections can be ordered. +const ( + IssueCommentOrderFieldUpdatedAt IssueCommentOrderField = "UPDATED_AT" // Order issue comments by update time. +) + // IssueOrderField represents properties by which issue connections can be ordered. type IssueOrderField string @@ -366,17 +421,6 @@ const ( IssueOrderFieldComments IssueOrderField = "COMMENTS" // Order issues by comment count. ) -// IssuePubSubTopic represents the possible PubSub channels for an issue. -type IssuePubSubTopic string - -// The possible PubSub channels for an issue. -const ( - IssuePubSubTopicUpdated IssuePubSubTopic = "UPDATED" // The channel ID for observing issue updates. - IssuePubSubTopicMarkasread IssuePubSubTopic = "MARKASREAD" // The channel ID for marking an issue as read. - IssuePubSubTopicTimeline IssuePubSubTopic = "TIMELINE" // The channel ID for updating items on the issue timeline. - IssuePubSubTopicState IssuePubSubTopic = "STATE" // The channel ID for observing issue state updates. -) - // IssueState represents the possible states of an issue. type IssueState string @@ -397,8 +441,10 @@ const ( IssueTimelineItemsItemTypeAssignedEvent IssueTimelineItemsItemType = "ASSIGNED_EVENT" // Represents an 'assigned' event on any assignable object. IssueTimelineItemsItemTypeClosedEvent IssueTimelineItemsItemType = "CLOSED_EVENT" // Represents a 'closed' event on any `Closable`. IssueTimelineItemsItemTypeCommentDeletedEvent IssueTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request. + IssueTimelineItemsItemTypeConnectedEvent IssueTimelineItemsItemType = "CONNECTED_EVENT" // Represents a 'connected' event on a given issue or pull request. IssueTimelineItemsItemTypeConvertedNoteToIssueEvent IssueTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request. IssueTimelineItemsItemTypeDemilestonedEvent IssueTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request. + IssueTimelineItemsItemTypeDisconnectedEvent IssueTimelineItemsItemType = "DISCONNECTED_EVENT" // Represents a 'disconnected' event on a given issue or pull request. IssueTimelineItemsItemTypeLabeledEvent IssueTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request. IssueTimelineItemsItemTypeLockedEvent IssueTimelineItemsItemType = "LOCKED_EVENT" // Represents a 'locked' event on a given issue or pull request. IssueTimelineItemsItemTypeMarkedAsDuplicateEvent IssueTimelineItemsItemType = "MARKED_AS_DUPLICATE_EVENT" // Represents a 'marked_as_duplicate' event on a given issue or pull request. @@ -416,10 +462,20 @@ const ( IssueTimelineItemsItemTypeUnlabeledEvent IssueTimelineItemsItemType = "UNLABELED_EVENT" // Represents an 'unlabeled' event on a given issue or pull request. IssueTimelineItemsItemTypeUnlockedEvent IssueTimelineItemsItemType = "UNLOCKED_EVENT" // Represents an 'unlocked' event on a given issue or pull request. IssueTimelineItemsItemTypeUserBlockedEvent IssueTimelineItemsItemType = "USER_BLOCKED_EVENT" // Represents a 'user_blocked' event on a given user. + IssueTimelineItemsItemTypeUnmarkedAsDuplicateEvent IssueTimelineItemsItemType = "UNMARKED_AS_DUPLICATE_EVENT" // Represents an 'unmarked_as_duplicate' event on a given issue or pull request. IssueTimelineItemsItemTypeUnpinnedEvent IssueTimelineItemsItemType = "UNPINNED_EVENT" // Represents an 'unpinned' event on a given issue or pull request. IssueTimelineItemsItemTypeUnsubscribedEvent IssueTimelineItemsItemType = "UNSUBSCRIBED_EVENT" // Represents an 'unsubscribed' event on a given `Subscribable`. ) +// LabelOrderField represents properties by which label connections can be ordered. +type LabelOrderField string + +// Properties by which label connections can be ordered. +const ( + LabelOrderFieldName LabelOrderField = "NAME" // Order labels by name. + LabelOrderFieldCreatedAt LabelOrderField = "CREATED_AT" // Order labels by creation time. +) + // LanguageOrderField represents properties by which language connections can be ordered. type LanguageOrderField string @@ -479,16 +535,6 @@ const ( OauthApplicationCreateAuditEntryStatePendingDeletion OauthApplicationCreateAuditEntryState = "PENDING_DELETION" // The OAuth Application was in the process of being deleted. ) -// OauthApplicationRevokeTokensAuditEntryState represents the state of an OAuth Application when its tokens were revoked. -type OauthApplicationRevokeTokensAuditEntryState string - -// The state of an OAuth Application when its tokens were revoked. -const ( - OauthApplicationRevokeTokensAuditEntryStateActive OauthApplicationRevokeTokensAuditEntryState = "ACTIVE" // The OAuth Application was active and allowed to have OAuth Accesses. - OauthApplicationRevokeTokensAuditEntryStateSuspended OauthApplicationRevokeTokensAuditEntryState = "SUSPENDED" // The OAuth Application was suspended from generating OAuth Accesses due to abuse or security concerns. - OauthApplicationRevokeTokensAuditEntryStatePendingDeletion OauthApplicationRevokeTokensAuditEntryState = "PENDING_DELETION" // The OAuth Application was in the process of being deleted. -) - // OperationType represents the corresponding operation type for the action. type OperationType string @@ -563,6 +609,8 @@ const ( OrgRemoveMemberAuditEntryReasonTwoFactorRequirementNonCompliance OrgRemoveMemberAuditEntryReason = "TWO_FACTOR_REQUIREMENT_NON_COMPLIANCE" // The organization required 2FA of its billing managers and this user did not have 2FA enabled. OrgRemoveMemberAuditEntryReasonSamlExternalIdentityMissing OrgRemoveMemberAuditEntryReason = "SAML_EXTERNAL_IDENTITY_MISSING" // SAML external identity missing. OrgRemoveMemberAuditEntryReasonSamlSsoEnforcementRequiresExternalIdentity OrgRemoveMemberAuditEntryReason = "SAML_SSO_ENFORCEMENT_REQUIRES_EXTERNAL_IDENTITY" // SAML SSO enforcement requires an external identity. + OrgRemoveMemberAuditEntryReasonUserAccountDeleted OrgRemoveMemberAuditEntryReason = "USER_ACCOUNT_DELETED" // User account has been deleted. + OrgRemoveMemberAuditEntryReasonTwoFactorAccountRecovery OrgRemoveMemberAuditEntryReason = "TWO_FACTOR_ACCOUNT_RECOVERY" // User was removed from organization during account recovery. ) // OrgRemoveOutsideCollaboratorAuditEntryMembershipType represents the type of membership a user has with an Organization. @@ -609,8 +657,14 @@ type OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility string // The permissions available for repository creation on an Organization. const ( - OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityAll OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "ALL" // All organization members are restricted from creating any repositories. - OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityPublic OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "PUBLIC" // All organization members are restricted from creating public repositories. + OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityAll OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "ALL" // All organization members are restricted from creating any repositories. + OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityPublic OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "PUBLIC" // All organization members are restricted from creating public repositories. + OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityNone OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "NONE" // All organization members are allowed to create any repositories. + OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityPrivate OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "PRIVATE" // All organization members are restricted from creating private repositories. + OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityInternal OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "INTERNAL" // All organization members are restricted from creating internal repositories. + OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityPublicInternal OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "PUBLIC_INTERNAL" // All organization members are restricted from creating public or internal repositories. + OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityPrivateInternal OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "PRIVATE_INTERNAL" // All organization members are restricted from creating private or internal repositories. + OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibilityPublicPrivate OrgUpdateMemberRepositoryCreationPermissionAuditEntryVisibility = "PUBLIC_PRIVATE" // All organization members are restricted from creating public or private repositories. ) // OrganizationInvitationRole represents the possible organization invitation roles. @@ -661,6 +715,44 @@ const ( OrganizationOrderFieldLogin OrganizationOrderField = "LOGIN" // Order organizations by login. ) +// PackageFileOrderField represents properties by which package file connections can be ordered. +type PackageFileOrderField string + +// Properties by which package file connections can be ordered. +const ( + PackageFileOrderFieldCreatedAt PackageFileOrderField = "CREATED_AT" // Order package files by creation time. +) + +// PackageOrderField represents properties by which package connections can be ordered. +type PackageOrderField string + +// Properties by which package connections can be ordered. +const ( + PackageOrderFieldCreatedAt PackageOrderField = "CREATED_AT" // Order packages by creation time. +) + +// PackageType represents the possible types of a package. +type PackageType string + +// The possible types of a package. +const ( + PackageTypeNpm PackageType = "NPM" // An npm package. + PackageTypeRubygems PackageType = "RUBYGEMS" // A rubygems package. + PackageTypeMaven PackageType = "MAVEN" // A maven package. + PackageTypeDocker PackageType = "DOCKER" // A docker image. + PackageTypeDebian PackageType = "DEBIAN" // A debian package. + PackageTypeNuget PackageType = "NUGET" // A nuget package. + PackageTypePypi PackageType = "PYPI" // A python package. +) + +// PackageVersionOrderField represents properties by which package version connections can be ordered. +type PackageVersionOrderField string + +// Properties by which package version connections can be ordered. +const ( + PackageVersionOrderFieldCreatedAt PackageVersionOrderField = "CREATED_AT" // Order package versions by creation time. +) + // PinnableItemType represents represents items that can be pinned to a profile page or dashboard. type PinnableItemType string @@ -754,18 +846,6 @@ const ( PullRequestOrderFieldUpdatedAt PullRequestOrderField = "UPDATED_AT" // Order pull_requests by update time. ) -// PullRequestPubSubTopic represents the possible PubSub channels for a pull request. -type PullRequestPubSubTopic string - -// The possible PubSub channels for a pull request. -const ( - PullRequestPubSubTopicUpdated PullRequestPubSubTopic = "UPDATED" // The channel ID for observing pull request updates. - PullRequestPubSubTopicMarkasread PullRequestPubSubTopic = "MARKASREAD" // The channel ID for marking an pull request as read. - PullRequestPubSubTopicHeadRef PullRequestPubSubTopic = "HEAD_REF" // The channel ID for observing head ref updates. - PullRequestPubSubTopicTimeline PullRequestPubSubTopic = "TIMELINE" // The channel ID for updating items on the pull request timeline. - PullRequestPubSubTopicState PullRequestPubSubTopic = "STATE" // The channel ID for observing pull request state updates. -) - // PullRequestReviewCommentState represents the possible states of a pull request review comment. type PullRequestReviewCommentState string @@ -775,6 +855,16 @@ const ( PullRequestReviewCommentStateSubmitted PullRequestReviewCommentState = "SUBMITTED" // A comment that is part of a submitted review. ) +// PullRequestReviewDecision represents the review status of a pull request. +type PullRequestReviewDecision string + +// The review status of a pull request. +const ( + PullRequestReviewDecisionChangesRequested PullRequestReviewDecision = "CHANGES_REQUESTED" // Changes have been requested on the pull request. + PullRequestReviewDecisionApproved PullRequestReviewDecision = "APPROVED" // The pull request has received an approving review. + PullRequestReviewDecisionReviewRequired PullRequestReviewDecision = "REVIEW_REQUIRED" // A review is required before the pull request can be merged. +) + // PullRequestReviewEvent represents the possible events to perform on a pull request review. type PullRequestReviewEvent string @@ -813,50 +903,57 @@ type PullRequestTimelineItemsItemType string // The possible item types found in a timeline. const ( - PullRequestTimelineItemsItemTypePullRequestCommit PullRequestTimelineItemsItemType = "PULL_REQUEST_COMMIT" // Represents a Git commit part of a pull request. - PullRequestTimelineItemsItemTypePullRequestCommitCommentThread PullRequestTimelineItemsItemType = "PULL_REQUEST_COMMIT_COMMENT_THREAD" // Represents a commit comment thread part of a pull request. - PullRequestTimelineItemsItemTypePullRequestReview PullRequestTimelineItemsItemType = "PULL_REQUEST_REVIEW" // A review object for a given pull request. - PullRequestTimelineItemsItemTypePullRequestReviewThread PullRequestTimelineItemsItemType = "PULL_REQUEST_REVIEW_THREAD" // A threaded list of comments for a given pull request. - PullRequestTimelineItemsItemTypePullRequestRevisionMarker PullRequestTimelineItemsItemType = "PULL_REQUEST_REVISION_MARKER" // Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits. - PullRequestTimelineItemsItemTypeBaseRefChangedEvent PullRequestTimelineItemsItemType = "BASE_REF_CHANGED_EVENT" // Represents a 'base_ref_changed' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeBaseRefForcePushedEvent PullRequestTimelineItemsItemType = "BASE_REF_FORCE_PUSHED_EVENT" // Represents a 'base_ref_force_pushed' event on a given pull request. - PullRequestTimelineItemsItemTypeDeployedEvent PullRequestTimelineItemsItemType = "DEPLOYED_EVENT" // Represents a 'deployed' event on a given pull request. - PullRequestTimelineItemsItemTypeDeploymentEnvironmentChangedEvent PullRequestTimelineItemsItemType = "DEPLOYMENT_ENVIRONMENT_CHANGED_EVENT" // Represents a 'deployment_environment_changed' event on a given pull request. - PullRequestTimelineItemsItemTypeHeadRefDeletedEvent PullRequestTimelineItemsItemType = "HEAD_REF_DELETED_EVENT" // Represents a 'head_ref_deleted' event on a given pull request. - PullRequestTimelineItemsItemTypeHeadRefForcePushedEvent PullRequestTimelineItemsItemType = "HEAD_REF_FORCE_PUSHED_EVENT" // Represents a 'head_ref_force_pushed' event on a given pull request. - PullRequestTimelineItemsItemTypeHeadRefRestoredEvent PullRequestTimelineItemsItemType = "HEAD_REF_RESTORED_EVENT" // Represents a 'head_ref_restored' event on a given pull request. - PullRequestTimelineItemsItemTypeMergedEvent PullRequestTimelineItemsItemType = "MERGED_EVENT" // Represents a 'merged' event on a given pull request. - PullRequestTimelineItemsItemTypeReviewDismissedEvent PullRequestTimelineItemsItemType = "REVIEW_DISMISSED_EVENT" // Represents a 'review_dismissed' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeReviewRequestedEvent PullRequestTimelineItemsItemType = "REVIEW_REQUESTED_EVENT" // Represents an 'review_requested' event on a given pull request. - PullRequestTimelineItemsItemTypeReviewRequestRemovedEvent PullRequestTimelineItemsItemType = "REVIEW_REQUEST_REMOVED_EVENT" // Represents an 'review_request_removed' event on a given pull request. - PullRequestTimelineItemsItemTypeReadyForReviewEvent PullRequestTimelineItemsItemType = "READY_FOR_REVIEW_EVENT" // Represents a 'ready_for_review' event on a given pull request. - PullRequestTimelineItemsItemTypeIssueComment PullRequestTimelineItemsItemType = "ISSUE_COMMENT" // Represents a comment on an Issue. - PullRequestTimelineItemsItemTypeCrossReferencedEvent PullRequestTimelineItemsItemType = "CROSS_REFERENCED_EVENT" // Represents a mention made by one issue or pull request to another. - PullRequestTimelineItemsItemTypeAddedToProjectEvent PullRequestTimelineItemsItemType = "ADDED_TO_PROJECT_EVENT" // Represents a 'added_to_project' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeAssignedEvent PullRequestTimelineItemsItemType = "ASSIGNED_EVENT" // Represents an 'assigned' event on any assignable object. - PullRequestTimelineItemsItemTypeClosedEvent PullRequestTimelineItemsItemType = "CLOSED_EVENT" // Represents a 'closed' event on any `Closable`. - PullRequestTimelineItemsItemTypeCommentDeletedEvent PullRequestTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeConvertedNoteToIssueEvent PullRequestTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeDemilestonedEvent PullRequestTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeLabeledEvent PullRequestTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeLockedEvent PullRequestTimelineItemsItemType = "LOCKED_EVENT" // Represents a 'locked' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeMarkedAsDuplicateEvent PullRequestTimelineItemsItemType = "MARKED_AS_DUPLICATE_EVENT" // Represents a 'marked_as_duplicate' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeMentionedEvent PullRequestTimelineItemsItemType = "MENTIONED_EVENT" // Represents a 'mentioned' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeMilestonedEvent PullRequestTimelineItemsItemType = "MILESTONED_EVENT" // Represents a 'milestoned' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeMovedColumnsInProjectEvent PullRequestTimelineItemsItemType = "MOVED_COLUMNS_IN_PROJECT_EVENT" // Represents a 'moved_columns_in_project' event on a given issue or pull request. - PullRequestTimelineItemsItemTypePinnedEvent PullRequestTimelineItemsItemType = "PINNED_EVENT" // Represents a 'pinned' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeReferencedEvent PullRequestTimelineItemsItemType = "REFERENCED_EVENT" // Represents a 'referenced' event on a given `ReferencedSubject`. - PullRequestTimelineItemsItemTypeRemovedFromProjectEvent PullRequestTimelineItemsItemType = "REMOVED_FROM_PROJECT_EVENT" // Represents a 'removed_from_project' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeRenamedTitleEvent PullRequestTimelineItemsItemType = "RENAMED_TITLE_EVENT" // Represents a 'renamed' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeReopenedEvent PullRequestTimelineItemsItemType = "REOPENED_EVENT" // Represents a 'reopened' event on any `Closable`. - PullRequestTimelineItemsItemTypeSubscribedEvent PullRequestTimelineItemsItemType = "SUBSCRIBED_EVENT" // Represents a 'subscribed' event on a given `Subscribable`. - PullRequestTimelineItemsItemTypeTransferredEvent PullRequestTimelineItemsItemType = "TRANSFERRED_EVENT" // Represents a 'transferred' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeUnassignedEvent PullRequestTimelineItemsItemType = "UNASSIGNED_EVENT" // Represents an 'unassigned' event on any assignable object. - PullRequestTimelineItemsItemTypeUnlabeledEvent PullRequestTimelineItemsItemType = "UNLABELED_EVENT" // Represents an 'unlabeled' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeUnlockedEvent PullRequestTimelineItemsItemType = "UNLOCKED_EVENT" // Represents an 'unlocked' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeUserBlockedEvent PullRequestTimelineItemsItemType = "USER_BLOCKED_EVENT" // Represents a 'user_blocked' event on a given user. - PullRequestTimelineItemsItemTypeUnpinnedEvent PullRequestTimelineItemsItemType = "UNPINNED_EVENT" // Represents an 'unpinned' event on a given issue or pull request. - PullRequestTimelineItemsItemTypeUnsubscribedEvent PullRequestTimelineItemsItemType = "UNSUBSCRIBED_EVENT" // Represents an 'unsubscribed' event on a given `Subscribable`. + PullRequestTimelineItemsItemTypePullRequestCommit PullRequestTimelineItemsItemType = "PULL_REQUEST_COMMIT" // Represents a Git commit part of a pull request. + PullRequestTimelineItemsItemTypePullRequestCommitCommentThread PullRequestTimelineItemsItemType = "PULL_REQUEST_COMMIT_COMMENT_THREAD" // Represents a commit comment thread part of a pull request. + PullRequestTimelineItemsItemTypePullRequestReview PullRequestTimelineItemsItemType = "PULL_REQUEST_REVIEW" // A review object for a given pull request. + PullRequestTimelineItemsItemTypePullRequestReviewThread PullRequestTimelineItemsItemType = "PULL_REQUEST_REVIEW_THREAD" // A threaded list of comments for a given pull request. + PullRequestTimelineItemsItemTypePullRequestRevisionMarker PullRequestTimelineItemsItemType = "PULL_REQUEST_REVISION_MARKER" // Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits. + PullRequestTimelineItemsItemTypeAutomaticBaseChangeFailedEvent PullRequestTimelineItemsItemType = "AUTOMATIC_BASE_CHANGE_FAILED_EVENT" // Represents a 'automatic_base_change_failed' event on a given pull request. + PullRequestTimelineItemsItemTypeAutomaticBaseChangeSucceededEvent PullRequestTimelineItemsItemType = "AUTOMATIC_BASE_CHANGE_SUCCEEDED_EVENT" // Represents a 'automatic_base_change_succeeded' event on a given pull request. + PullRequestTimelineItemsItemTypeBaseRefChangedEvent PullRequestTimelineItemsItemType = "BASE_REF_CHANGED_EVENT" // Represents a 'base_ref_changed' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeBaseRefForcePushedEvent PullRequestTimelineItemsItemType = "BASE_REF_FORCE_PUSHED_EVENT" // Represents a 'base_ref_force_pushed' event on a given pull request. + PullRequestTimelineItemsItemTypeBaseRefDeletedEvent PullRequestTimelineItemsItemType = "BASE_REF_DELETED_EVENT" // Represents a 'base_ref_deleted' event on a given pull request. + PullRequestTimelineItemsItemTypeDeployedEvent PullRequestTimelineItemsItemType = "DEPLOYED_EVENT" // Represents a 'deployed' event on a given pull request. + PullRequestTimelineItemsItemTypeDeploymentEnvironmentChangedEvent PullRequestTimelineItemsItemType = "DEPLOYMENT_ENVIRONMENT_CHANGED_EVENT" // Represents a 'deployment_environment_changed' event on a given pull request. + PullRequestTimelineItemsItemTypeHeadRefDeletedEvent PullRequestTimelineItemsItemType = "HEAD_REF_DELETED_EVENT" // Represents a 'head_ref_deleted' event on a given pull request. + PullRequestTimelineItemsItemTypeHeadRefForcePushedEvent PullRequestTimelineItemsItemType = "HEAD_REF_FORCE_PUSHED_EVENT" // Represents a 'head_ref_force_pushed' event on a given pull request. + PullRequestTimelineItemsItemTypeHeadRefRestoredEvent PullRequestTimelineItemsItemType = "HEAD_REF_RESTORED_EVENT" // Represents a 'head_ref_restored' event on a given pull request. + PullRequestTimelineItemsItemTypeMergedEvent PullRequestTimelineItemsItemType = "MERGED_EVENT" // Represents a 'merged' event on a given pull request. + PullRequestTimelineItemsItemTypeReviewDismissedEvent PullRequestTimelineItemsItemType = "REVIEW_DISMISSED_EVENT" // Represents a 'review_dismissed' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeReviewRequestedEvent PullRequestTimelineItemsItemType = "REVIEW_REQUESTED_EVENT" // Represents an 'review_requested' event on a given pull request. + PullRequestTimelineItemsItemTypeReviewRequestRemovedEvent PullRequestTimelineItemsItemType = "REVIEW_REQUEST_REMOVED_EVENT" // Represents an 'review_request_removed' event on a given pull request. + PullRequestTimelineItemsItemTypeReadyForReviewEvent PullRequestTimelineItemsItemType = "READY_FOR_REVIEW_EVENT" // Represents a 'ready_for_review' event on a given pull request. + PullRequestTimelineItemsItemTypeConvertToDraftEvent PullRequestTimelineItemsItemType = "CONVERT_TO_DRAFT_EVENT" // Represents a 'convert_to_draft' event on a given pull request. + PullRequestTimelineItemsItemTypeIssueComment PullRequestTimelineItemsItemType = "ISSUE_COMMENT" // Represents a comment on an Issue. + PullRequestTimelineItemsItemTypeCrossReferencedEvent PullRequestTimelineItemsItemType = "CROSS_REFERENCED_EVENT" // Represents a mention made by one issue or pull request to another. + PullRequestTimelineItemsItemTypeAddedToProjectEvent PullRequestTimelineItemsItemType = "ADDED_TO_PROJECT_EVENT" // Represents a 'added_to_project' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeAssignedEvent PullRequestTimelineItemsItemType = "ASSIGNED_EVENT" // Represents an 'assigned' event on any assignable object. + PullRequestTimelineItemsItemTypeClosedEvent PullRequestTimelineItemsItemType = "CLOSED_EVENT" // Represents a 'closed' event on any `Closable`. + PullRequestTimelineItemsItemTypeCommentDeletedEvent PullRequestTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeConnectedEvent PullRequestTimelineItemsItemType = "CONNECTED_EVENT" // Represents a 'connected' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeConvertedNoteToIssueEvent PullRequestTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeDemilestonedEvent PullRequestTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeDisconnectedEvent PullRequestTimelineItemsItemType = "DISCONNECTED_EVENT" // Represents a 'disconnected' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeLabeledEvent PullRequestTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeLockedEvent PullRequestTimelineItemsItemType = "LOCKED_EVENT" // Represents a 'locked' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeMarkedAsDuplicateEvent PullRequestTimelineItemsItemType = "MARKED_AS_DUPLICATE_EVENT" // Represents a 'marked_as_duplicate' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeMentionedEvent PullRequestTimelineItemsItemType = "MENTIONED_EVENT" // Represents a 'mentioned' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeMilestonedEvent PullRequestTimelineItemsItemType = "MILESTONED_EVENT" // Represents a 'milestoned' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeMovedColumnsInProjectEvent PullRequestTimelineItemsItemType = "MOVED_COLUMNS_IN_PROJECT_EVENT" // Represents a 'moved_columns_in_project' event on a given issue or pull request. + PullRequestTimelineItemsItemTypePinnedEvent PullRequestTimelineItemsItemType = "PINNED_EVENT" // Represents a 'pinned' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeReferencedEvent PullRequestTimelineItemsItemType = "REFERENCED_EVENT" // Represents a 'referenced' event on a given `ReferencedSubject`. + PullRequestTimelineItemsItemTypeRemovedFromProjectEvent PullRequestTimelineItemsItemType = "REMOVED_FROM_PROJECT_EVENT" // Represents a 'removed_from_project' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeRenamedTitleEvent PullRequestTimelineItemsItemType = "RENAMED_TITLE_EVENT" // Represents a 'renamed' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeReopenedEvent PullRequestTimelineItemsItemType = "REOPENED_EVENT" // Represents a 'reopened' event on any `Closable`. + PullRequestTimelineItemsItemTypeSubscribedEvent PullRequestTimelineItemsItemType = "SUBSCRIBED_EVENT" // Represents a 'subscribed' event on a given `Subscribable`. + PullRequestTimelineItemsItemTypeTransferredEvent PullRequestTimelineItemsItemType = "TRANSFERRED_EVENT" // Represents a 'transferred' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeUnassignedEvent PullRequestTimelineItemsItemType = "UNASSIGNED_EVENT" // Represents an 'unassigned' event on any assignable object. + PullRequestTimelineItemsItemTypeUnlabeledEvent PullRequestTimelineItemsItemType = "UNLABELED_EVENT" // Represents an 'unlabeled' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeUnlockedEvent PullRequestTimelineItemsItemType = "UNLOCKED_EVENT" // Represents an 'unlocked' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeUserBlockedEvent PullRequestTimelineItemsItemType = "USER_BLOCKED_EVENT" // Represents a 'user_blocked' event on a given user. + PullRequestTimelineItemsItemTypeUnmarkedAsDuplicateEvent PullRequestTimelineItemsItemType = "UNMARKED_AS_DUPLICATE_EVENT" // Represents an 'unmarked_as_duplicate' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeUnpinnedEvent PullRequestTimelineItemsItemType = "UNPINNED_EVENT" // Represents an 'unpinned' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeUnsubscribedEvent PullRequestTimelineItemsItemType = "UNSUBSCRIBED_EVENT" // Represents an 'unsubscribed' event on a given `Subscribable`. ) // PullRequestUpdateState represents the possible target states when updating a pull request. @@ -900,42 +997,6 @@ const ( RefOrderFieldAlphabetical RefOrderField = "ALPHABETICAL" // Order refs by their alphanumeric name. ) -// RegistryPackageDependencyType represents the possible types of a registry package dependency. -type RegistryPackageDependencyType string - -// The possible types of a registry package dependency. -const ( - RegistryPackageDependencyTypeDefault RegistryPackageDependencyType = "DEFAULT" // A default registry package dependency type. - RegistryPackageDependencyTypeDev RegistryPackageDependencyType = "DEV" // A dev registry package dependency type. - RegistryPackageDependencyTypeTest RegistryPackageDependencyType = "TEST" // A test registry package dependency type. - RegistryPackageDependencyTypePeer RegistryPackageDependencyType = "PEER" // A peer registry package dependency type. - RegistryPackageDependencyTypeOptional RegistryPackageDependencyType = "OPTIONAL" // An optional registry package dependency type. - RegistryPackageDependencyTypeBundled RegistryPackageDependencyType = "BUNDLED" // An optional registry package dependency type. -) - -// RegistryPackageFileState represents the possible states of a registry package file. -type RegistryPackageFileState string - -// The possible states of a registry package file. -const ( - RegistryPackageFileStateNew RegistryPackageFileState = "NEW" // Package file doesn't have a blob backing it. - RegistryPackageFileStateUploaded RegistryPackageFileState = "UPLOADED" // All Package file contents have been uploaded. -) - -// RegistryPackageType represents the possible types of a registry package. -type RegistryPackageType string - -// The possible types of a registry package. -const ( - RegistryPackageTypeNpm RegistryPackageType = "NPM" // An npm registry package. - RegistryPackageTypeRubygems RegistryPackageType = "RUBYGEMS" // A rubygems registry package. - RegistryPackageTypeMaven RegistryPackageType = "MAVEN" // A maven registry package. - RegistryPackageTypeDocker RegistryPackageType = "DOCKER" // A docker image. - RegistryPackageTypeDebian RegistryPackageType = "DEBIAN" // A debian package. - RegistryPackageTypeNuget RegistryPackageType = "NUGET" // A nuget package. - RegistryPackageTypePython RegistryPackageType = "PYTHON" // A python package. -) - // ReleaseOrderField represents properties by which release connections can be ordered. type ReleaseOrderField string @@ -1020,11 +1081,12 @@ type ReportedContentClassifiers string // The reasons a piece of content can be reported or minimized. const ( - ReportedContentClassifiersSpam ReportedContentClassifiers = "SPAM" // A spammy piece of content. - ReportedContentClassifiersAbuse ReportedContentClassifiers = "ABUSE" // An abusive or harassing piece of content. - ReportedContentClassifiersOffTopic ReportedContentClassifiers = "OFF_TOPIC" // An irrelevant piece of content. - ReportedContentClassifiersOutdated ReportedContentClassifiers = "OUTDATED" // An outdated piece of content. - ReportedContentClassifiersResolved ReportedContentClassifiers = "RESOLVED" // The content has been resolved. + ReportedContentClassifiersSpam ReportedContentClassifiers = "SPAM" // A spammy piece of content. + ReportedContentClassifiersAbuse ReportedContentClassifiers = "ABUSE" // An abusive or harassing piece of content. + ReportedContentClassifiersOffTopic ReportedContentClassifiers = "OFF_TOPIC" // An irrelevant piece of content. + ReportedContentClassifiersOutdated ReportedContentClassifiers = "OUTDATED" // An outdated piece of content. + ReportedContentClassifiersDuplicate ReportedContentClassifiers = "DUPLICATE" // A duplicated piece of content. + ReportedContentClassifiersResolved ReportedContentClassifiers = "RESOLVED" // The content has been resolved. ) // RepositoryAffiliation represents the affiliation of a user to a repository. @@ -1037,15 +1099,6 @@ const ( RepositoryAffiliationOrganizationMember RepositoryAffiliation = "ORGANIZATION_MEMBER" // Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on. ) -// RepositoryCollaboratorAffiliation represents the affiliation type between collaborator and repository. -type RepositoryCollaboratorAffiliation string - -// The affiliation type between collaborator and repository. -const ( - RepositoryCollaboratorAffiliationAll RepositoryCollaboratorAffiliation = "ALL" // All collaborators of the repository. - RepositoryCollaboratorAffiliationOutside RepositoryCollaboratorAffiliation = "OUTSIDE" // All outside collaborators of an organization-owned repository. -) - // RepositoryContributionType represents the reason a repository is listed as 'contributed'. type RepositoryContributionType string @@ -1058,6 +1111,39 @@ const ( RepositoryContributionTypePullRequestReview RepositoryContributionType = "PULL_REQUEST_REVIEW" // Reviewed a pull request. ) +// RepositoryInteractionLimit represents a repository interaction limit. +type RepositoryInteractionLimit string + +// A repository interaction limit. +const ( + RepositoryInteractionLimitExistingUsers RepositoryInteractionLimit = "EXISTING_USERS" // Users that have recently created their account will be unable to interact with the repository. + RepositoryInteractionLimitContributorsOnly RepositoryInteractionLimit = "CONTRIBUTORS_ONLY" // Users that have not previously committed to a repository’s default branch will be unable to interact with the repository. + RepositoryInteractionLimitCollaboratorsOnly RepositoryInteractionLimit = "COLLABORATORS_ONLY" // Users that are not collaborators will not be able to interact with the repository. + RepositoryInteractionLimitNoLimit RepositoryInteractionLimit = "NO_LIMIT" // No interaction limits are enabled. +) + +// RepositoryInteractionLimitExpiry represents the length for a repository interaction limit to be enabled for. +type RepositoryInteractionLimitExpiry string + +// The length for a repository interaction limit to be enabled for. +const ( + RepositoryInteractionLimitExpiryOneDay RepositoryInteractionLimitExpiry = "ONE_DAY" // The interaction limit will expire after 1 day. + RepositoryInteractionLimitExpiryThreeDays RepositoryInteractionLimitExpiry = "THREE_DAYS" // The interaction limit will expire after 3 days. + RepositoryInteractionLimitExpiryOneWeek RepositoryInteractionLimitExpiry = "ONE_WEEK" // The interaction limit will expire after 1 week. + RepositoryInteractionLimitExpiryOneMonth RepositoryInteractionLimitExpiry = "ONE_MONTH" // The interaction limit will expire after 1 month. + RepositoryInteractionLimitExpirySixMonths RepositoryInteractionLimitExpiry = "SIX_MONTHS" // The interaction limit will expire after 6 months. +) + +// RepositoryInteractionLimitOrigin represents indicates where an interaction limit is configured. +type RepositoryInteractionLimitOrigin string + +// Indicates where an interaction limit is configured. +const ( + RepositoryInteractionLimitOriginRepository RepositoryInteractionLimitOrigin = "REPOSITORY" // A limit that is configured at the repository level. + RepositoryInteractionLimitOriginOrganization RepositoryInteractionLimitOrigin = "ORGANIZATION" // A limit that is configured at the organization level. + RepositoryInteractionLimitOriginUser RepositoryInteractionLimitOrigin = "USER" // A limit that is configured at the user-wide level. +) + // RepositoryInvitationOrderField represents properties by which repository invitation connections can be ordered. type RepositoryInvitationOrderField string @@ -1121,6 +1207,16 @@ const ( RepositoryVisibilityInternal RepositoryVisibility = "INTERNAL" // The repository is visible only to users in the same business. ) +// RequestableCheckStatusState represents the possible states that can be requested when creating a check run. +type RequestableCheckStatusState string + +// The possible states that can be requested when creating a check run. +const ( + RequestableCheckStatusStateQueued RequestableCheckStatusState = "QUEUED" // The check suite or run has been queued. + RequestableCheckStatusStateInProgress RequestableCheckStatusState = "IN_PROGRESS" // The check suite or run is in progress. + RequestableCheckStatusStateCompleted RequestableCheckStatusState = "COMPLETED" // The check suite or run has been completed. +) + // SamlDigestAlgorithm represents the possible digest algorithms used to sign SAML requests for an identity provider. type SamlDigestAlgorithm string diff --git a/vendor/github.com/shurcooL/githubv4/input.go b/vendor/github.com/shurcooL/githubv4/input.go index 91555f4e46..550d544e98 100644 --- a/vendor/github.com/shurcooL/githubv4/input.go +++ b/vendor/github.com/shurcooL/githubv4/input.go @@ -4,7 +4,7 @@ package githubv4 // Input represents one of the Input structs: // -// AcceptEnterpriseAdministratorInvitationInput, AcceptTopicSuggestionInput, AddAssigneesToAssignableInput, AddCommentInput, AddLabelsToLabelableInput, AddProjectCardInput, AddProjectColumnInput, AddPullRequestReviewCommentInput, AddPullRequestReviewInput, AddReactionInput, AddStarInput, ArchiveRepositoryInput, AuditLogOrder, CancelEnterpriseAdminInvitationInput, ChangeUserStatusInput, ClearLabelsFromLabelableInput, CloneProjectInput, CloneTemplateRepositoryInput, CloseIssueInput, ClosePullRequestInput, CommitAuthor, CommitContributionOrder, ContributionOrder, ConvertProjectCardNoteToIssueInput, CreateBranchProtectionRuleInput, CreateContentAttachmentInput, CreateEnterpriseOrganizationInput, CreateIssueInput, CreateProjectInput, CreatePullRequestInput, CreateRefInput, CreateRepositoryInput, CreateTeamDiscussionCommentInput, CreateTeamDiscussionInput, DeclineTopicSuggestionInput, DeleteBranchProtectionRuleInput, DeleteIssueCommentInput, DeleteIssueInput, DeletePackageVersionInput, DeleteProjectCardInput, DeleteProjectColumnInput, DeleteProjectInput, DeletePullRequestReviewCommentInput, DeletePullRequestReviewInput, DeleteRefInput, DeleteTeamDiscussionCommentInput, DeleteTeamDiscussionInput, DeploymentOrder, DismissPullRequestReviewInput, DraftPullRequestReviewComment, EnterpriseAdministratorInvitationOrder, EnterpriseMemberOrder, EnterpriseOrder, EnterpriseServerInstallationOrder, EnterpriseServerUserAccountEmailOrder, EnterpriseServerUserAccountOrder, EnterpriseServerUserAccountsUploadOrder, FollowUserInput, GistOrder, ImportProjectInput, InviteEnterpriseAdminInput, IssueFilters, IssueOrder, LanguageOrder, LinkRepositoryToProjectInput, LockLockableInput, MergeBranchInput, MergePullRequestInput, MilestoneOrder, MinimizeCommentInput, MoveProjectCardInput, MoveProjectColumnInput, OrganizationOrder, PinIssueInput, ProjectCardImport, ProjectColumnImport, ProjectOrder, PullRequestOrder, ReactionOrder, RefOrder, RegenerateEnterpriseIdentityProviderRecoveryCodesInput, RegistryPackageMetadatum, ReleaseOrder, RemoveAssigneesFromAssignableInput, RemoveEnterpriseAdminInput, RemoveEnterpriseOrganizationInput, RemoveLabelsFromLabelableInput, RemoveOutsideCollaboratorInput, RemoveReactionInput, RemoveStarInput, ReopenIssueInput, ReopenPullRequestInput, RepositoryInvitationOrder, RepositoryOrder, RequestReviewsInput, ResolveReviewThreadInput, SavedReplyOrder, SecurityAdvisoryIdentifierFilter, SecurityAdvisoryOrder, SecurityVulnerabilityOrder, SponsorsTierOrder, SponsorshipOrder, StarOrder, SubmitPullRequestReviewInput, TeamDiscussionCommentOrder, TeamDiscussionOrder, TeamMemberOrder, TeamOrder, TeamRepositoryOrder, TransferIssueInput, UnarchiveRepositoryInput, UnfollowUserInput, UnlinkRepositoryFromProjectInput, UnlockLockableInput, UnmarkIssueAsDuplicateInput, UnminimizeCommentInput, UnpinIssueInput, UnresolveReviewThreadInput, UpdateBranchProtectionRuleInput, UpdateEnterpriseActionExecutionCapabilitySettingInput, UpdateEnterpriseAdministratorRoleInput, UpdateEnterpriseAllowPrivateRepositoryForkingSettingInput, UpdateEnterpriseDefaultRepositoryPermissionSettingInput, UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingInput, UpdateEnterpriseMembersCanCreateRepositoriesSettingInput, UpdateEnterpriseMembersCanDeleteIssuesSettingInput, UpdateEnterpriseMembersCanDeleteRepositoriesSettingInput, UpdateEnterpriseMembersCanInviteCollaboratorsSettingInput, UpdateEnterpriseMembersCanMakePurchasesSettingInput, UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingInput, UpdateEnterpriseMembersCanViewDependencyInsightsSettingInput, UpdateEnterpriseOrganizationProjectsSettingInput, UpdateEnterpriseProfileInput, UpdateEnterpriseRepositoryProjectsSettingInput, UpdateEnterpriseTeamDiscussionsSettingInput, UpdateEnterpriseTwoFactorAuthenticationRequiredSettingInput, UpdateIssueCommentInput, UpdateIssueInput, UpdateProjectCardInput, UpdateProjectColumnInput, UpdateProjectInput, UpdatePullRequestInput, UpdatePullRequestReviewCommentInput, UpdatePullRequestReviewInput, UpdateRefInput, UpdateRepositoryInput, UpdateSubscriptionInput, UpdateTeamDiscussionCommentInput, UpdateTeamDiscussionInput, UpdateTopicsInput, UserStatusOrder. +// AcceptEnterpriseAdministratorInvitationInput, AcceptTopicSuggestionInput, AddAssigneesToAssignableInput, AddCommentInput, AddLabelsToLabelableInput, AddProjectCardInput, AddProjectColumnInput, AddPullRequestReviewCommentInput, AddPullRequestReviewInput, AddPullRequestReviewThreadInput, AddReactionInput, AddStarInput, ArchiveRepositoryInput, AuditLogOrder, CancelEnterpriseAdminInvitationInput, ChangeUserStatusInput, CheckAnnotationData, CheckAnnotationRange, CheckRunAction, CheckRunFilter, CheckRunOutput, CheckRunOutputImage, CheckSuiteAutoTriggerPreference, CheckSuiteFilter, ClearLabelsFromLabelableInput, CloneProjectInput, CloneTemplateRepositoryInput, CloseIssueInput, ClosePullRequestInput, CommitAuthor, CommitContributionOrder, ContributionOrder, ConvertProjectCardNoteToIssueInput, CreateBranchProtectionRuleInput, CreateCheckRunInput, CreateCheckSuiteInput, CreateEnterpriseOrganizationInput, CreateIpAllowListEntryInput, CreateIssueInput, CreateProjectInput, CreatePullRequestInput, CreateRefInput, CreateRepositoryInput, CreateTeamDiscussionCommentInput, CreateTeamDiscussionInput, DeclineTopicSuggestionInput, DeleteBranchProtectionRuleInput, DeleteDeploymentInput, DeleteIpAllowListEntryInput, DeleteIssueCommentInput, DeleteIssueInput, DeleteProjectCardInput, DeleteProjectColumnInput, DeleteProjectInput, DeletePullRequestReviewCommentInput, DeletePullRequestReviewInput, DeleteRefInput, DeleteTeamDiscussionCommentInput, DeleteTeamDiscussionInput, DeploymentOrder, DismissPullRequestReviewInput, DraftPullRequestReviewComment, DraftPullRequestReviewThread, EnterpriseAdministratorInvitationOrder, EnterpriseMemberOrder, EnterpriseServerInstallationOrder, EnterpriseServerUserAccountEmailOrder, EnterpriseServerUserAccountOrder, EnterpriseServerUserAccountsUploadOrder, FollowUserInput, GistOrder, InviteEnterpriseAdminInput, IpAllowListEntryOrder, IssueCommentOrder, IssueFilters, IssueOrder, LabelOrder, LanguageOrder, LinkRepositoryToProjectInput, LockLockableInput, MarkFileAsViewedInput, MarkPullRequestReadyForReviewInput, MergeBranchInput, MergePullRequestInput, MilestoneOrder, MinimizeCommentInput, MoveProjectCardInput, MoveProjectColumnInput, OrganizationOrder, PackageFileOrder, PackageOrder, PackageVersionOrder, ProjectOrder, PullRequestOrder, ReactionOrder, RefOrder, RegenerateEnterpriseIdentityProviderRecoveryCodesInput, ReleaseOrder, RemoveAssigneesFromAssignableInput, RemoveEnterpriseAdminInput, RemoveEnterpriseIdentityProviderInput, RemoveEnterpriseOrganizationInput, RemoveLabelsFromLabelableInput, RemoveOutsideCollaboratorInput, RemoveReactionInput, RemoveStarInput, ReopenIssueInput, ReopenPullRequestInput, RepositoryInvitationOrder, RepositoryOrder, RequestReviewsInput, RerequestCheckSuiteInput, ResolveReviewThreadInput, SavedReplyOrder, SecurityAdvisoryIdentifierFilter, SecurityAdvisoryOrder, SecurityVulnerabilityOrder, SetEnterpriseIdentityProviderInput, SetOrganizationInteractionLimitInput, SetRepositoryInteractionLimitInput, SetUserInteractionLimitInput, SponsorsTierOrder, SponsorshipOrder, StarOrder, SubmitPullRequestReviewInput, TeamDiscussionCommentOrder, TeamDiscussionOrder, TeamMemberOrder, TeamOrder, TeamRepositoryOrder, TransferIssueInput, UnarchiveRepositoryInput, UnfollowUserInput, UnlinkRepositoryFromProjectInput, UnlockLockableInput, UnmarkFileAsViewedInput, UnmarkIssueAsDuplicateInput, UnminimizeCommentInput, UnresolveReviewThreadInput, UpdateBranchProtectionRuleInput, UpdateCheckRunInput, UpdateCheckSuitePreferencesInput, UpdateEnterpriseAdministratorRoleInput, UpdateEnterpriseAllowPrivateRepositoryForkingSettingInput, UpdateEnterpriseDefaultRepositoryPermissionSettingInput, UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingInput, UpdateEnterpriseMembersCanCreateRepositoriesSettingInput, UpdateEnterpriseMembersCanDeleteIssuesSettingInput, UpdateEnterpriseMembersCanDeleteRepositoriesSettingInput, UpdateEnterpriseMembersCanInviteCollaboratorsSettingInput, UpdateEnterpriseMembersCanMakePurchasesSettingInput, UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingInput, UpdateEnterpriseMembersCanViewDependencyInsightsSettingInput, UpdateEnterpriseOrganizationProjectsSettingInput, UpdateEnterpriseProfileInput, UpdateEnterpriseRepositoryProjectsSettingInput, UpdateEnterpriseTeamDiscussionsSettingInput, UpdateEnterpriseTwoFactorAuthenticationRequiredSettingInput, UpdateIpAllowListEnabledSettingInput, UpdateIpAllowListEntryInput, UpdateIssueCommentInput, UpdateIssueInput, UpdateProjectCardInput, UpdateProjectColumnInput, UpdateProjectInput, UpdatePullRequestInput, UpdatePullRequestReviewCommentInput, UpdatePullRequestReviewInput, UpdateRefInput, UpdateRepositoryInput, UpdateSubscriptionInput, UpdateTeamDiscussionCommentInput, UpdateTeamDiscussionInput, UpdateTopicsInput, UserStatusOrder. type Input interface{} // AcceptEnterpriseAdministratorInvitationInput is an autogenerated input type of AcceptEnterpriseAdministratorInvitation. @@ -86,11 +86,13 @@ type AddProjectColumnInput struct { // AddPullRequestReviewCommentInput is an autogenerated input type of AddPullRequestReviewComment. type AddPullRequestReviewCommentInput struct { - // The Node ID of the review to modify. (Required.) - PullRequestReviewID ID `json:"pullRequestReviewId"` // The text of the comment. (Required.) Body String `json:"body"` + // The node ID of the pull request reviewing. (Optional.) + PullRequestID *ID `json:"pullRequestId,omitempty"` + // The Node ID of the review to modify. (Optional.) + PullRequestReviewID *ID `json:"pullRequestReviewId,omitempty"` // The SHA of the commit to comment on. (Optional.) CommitOID *GitObjectID `json:"commitOID,omitempty"` // The relative path of the file to comment on. (Optional.) @@ -116,6 +118,31 @@ type AddPullRequestReviewInput struct { Event *PullRequestReviewEvent `json:"event,omitempty"` // The review line comments. (Optional.) Comments *[]*DraftPullRequestReviewComment `json:"comments,omitempty"` + // The review line comment threads. (Optional.) + Threads *[]*DraftPullRequestReviewThread `json:"threads,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// AddPullRequestReviewThreadInput is an autogenerated input type of AddPullRequestReviewThread. +type AddPullRequestReviewThreadInput struct { + // Path to the file being commented on. (Required.) + Path String `json:"path"` + // Body of the thread's first comment. (Required.) + Body String `json:"body"` + // The line of the blob to which the thread refers. The end of the line range for multi-line comments. (Required.) + Line Int `json:"line"` + + // The node ID of the pull request reviewing. (Optional.) + PullRequestID *ID `json:"pullRequestId,omitempty"` + // The Node ID of the review to modify. (Optional.) + PullRequestReviewID *ID `json:"pullRequestReviewId,omitempty"` + // The side of the diff on which the line resides. For multi-line comments, this is the side for the end of the line range. (Optional.) + Side *DiffSide `json:"side,omitempty"` + // The first line of the range to which the comment refers. (Optional.) + StartLine *Int `json:"startLine,omitempty"` + // The side of the diff on which the start line resides. (Optional.) + StartSide *DiffSide `json:"startSide,omitempty"` // A unique identifier for the client performing the mutation. (Optional.) ClientMutationID *String `json:"clientMutationId,omitempty"` } @@ -184,6 +211,102 @@ type ChangeUserStatusInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// CheckAnnotationData represents information from a check run analysis to specific lines of code. +type CheckAnnotationData struct { + // The path of the file to add an annotation to. (Required.) + Path String `json:"path"` + // The location of the annotation. (Required.) + Location CheckAnnotationRange `json:"location"` + // Represents an annotation's information level. (Required.) + AnnotationLevel CheckAnnotationLevel `json:"annotationLevel"` + // A short description of the feedback for these lines of code. (Required.) + Message String `json:"message"` + + // The title that represents the annotation. (Optional.) + Title *String `json:"title,omitempty"` + // Details about this annotation. (Optional.) + RawDetails *String `json:"rawDetails,omitempty"` +} + +// CheckAnnotationRange represents information from a check run analysis to specific lines of code. +type CheckAnnotationRange struct { + // The starting line of the range. (Required.) + StartLine Int `json:"startLine"` + // The ending line of the range. (Required.) + EndLine Int `json:"endLine"` + + // The starting column of the range. (Optional.) + StartColumn *Int `json:"startColumn,omitempty"` + // The ending column of the range. (Optional.) + EndColumn *Int `json:"endColumn,omitempty"` +} + +// CheckRunAction represents possible further actions the integrator can perform. +type CheckRunAction struct { + // The text to be displayed on a button in the web UI. (Required.) + Label String `json:"label"` + // A short explanation of what this action would do. (Required.) + Description String `json:"description"` + // A reference for the action on the integrator's system. (Required.) + Identifier String `json:"identifier"` +} + +// CheckRunFilter represents the filters that are available when fetching check runs. +type CheckRunFilter struct { + + // Filters the check runs by this type. (Optional.) + CheckType *CheckRunType `json:"checkType,omitempty"` + // Filters the check runs created by this application ID. (Optional.) + AppID *Int `json:"appId,omitempty"` + // Filters the check runs by this name. (Optional.) + CheckName *String `json:"checkName,omitempty"` + // Filters the check runs by this status. (Optional.) + Status *CheckStatusState `json:"status,omitempty"` +} + +// CheckRunOutput represents descriptive details about the check run. +type CheckRunOutput struct { + // A title to provide for this check run. (Required.) + Title String `json:"title"` + // The summary of the check run (supports Commonmark). (Required.) + Summary String `json:"summary"` + + // The details of the check run (supports Commonmark). (Optional.) + Text *String `json:"text,omitempty"` + // The annotations that are made as part of the check run. (Optional.) + Annotations *[]CheckAnnotationData `json:"annotations,omitempty"` + // Images attached to the check run output displayed in the GitHub pull request UI. (Optional.) + Images *[]CheckRunOutputImage `json:"images,omitempty"` +} + +// CheckRunOutputImage represents images attached to the check run output displayed in the GitHub pull request UI. +type CheckRunOutputImage struct { + // The alternative text for the image. (Required.) + Alt String `json:"alt"` + // The full URL of the image. (Required.) + ImageURL URI `json:"imageUrl"` + + // A short image description. (Optional.) + Caption *String `json:"caption,omitempty"` +} + +// CheckSuiteAutoTriggerPreference represents the auto-trigger preferences that are available for check suites. +type CheckSuiteAutoTriggerPreference struct { + // The node ID of the application that owns the check suite. (Required.) + AppID ID `json:"appId"` + // Set to `true` to enable automatic creation of CheckSuite events upon pushes to the repository. (Required.) + Setting Boolean `json:"setting"` +} + +// CheckSuiteFilter represents the filters that are available when fetching check suites. +type CheckSuiteFilter struct { + + // Filters the check suites created by this application ID. (Optional.) + AppID *Int `json:"appId,omitempty"` + // Filters the check suites by this name. (Optional.) + CheckName *String `json:"checkName,omitempty"` +} + // ClearLabelsFromLabelableInput is an autogenerated input type of ClearLabelsFromLabelable. type ClearLabelsFromLabelableInput struct { // The id of the labelable object to clear the labels from. (Required.) @@ -225,6 +348,8 @@ type CloneTemplateRepositoryInput struct { // A short description of the new repository. (Optional.) Description *String `json:"description,omitempty"` + // Whether to copy all branches from the template to the new repository. Defaults to copying only the default branch of the template. (Optional.) + IncludeAllBranches *Boolean `json:"includeAllBranches,omitempty"` // A unique identifier for the client performing the mutation. (Optional.) ClientMutationID *String `json:"clientMutationId,omitempty"` } @@ -268,9 +393,6 @@ type CommitContributionOrder struct { type ContributionOrder struct { // The ordering direction. (Required.) Direction OrderDirection `json:"direction"` - - // The field by which to order contributions. **Upcoming Change on 2019-10-01 UTC** **Description:** `field` will be removed. Only one order field is supported. **Reason:** `field` will be removed. (Optional.) - Field *ContributionOrderField `json:"field,omitempty"` } // ConvertProjectCardNoteToIssueInput is an autogenerated input type of ConvertProjectCardNoteToIssue. @@ -301,6 +423,12 @@ type CreateBranchProtectionRuleInput struct { RequiredApprovingReviewCount *Int `json:"requiredApprovingReviewCount,omitempty"` // Are commits required to be signed. (Optional.) RequiresCommitSignatures *Boolean `json:"requiresCommitSignatures,omitempty"` + // Are merge commits prohibited from being pushed to this branch. (Optional.) + RequiresLinearHistory *Boolean `json:"requiresLinearHistory,omitempty"` + // Are force pushes allowed on this branch. (Optional.) + AllowsForcePushes *Boolean `json:"allowsForcePushes,omitempty"` + // Can this branch be deleted. (Optional.) + AllowsDeletions *Boolean `json:"allowsDeletions,omitempty"` // Can admins overwrite branch protection. (Optional.) IsAdminEnforced *Boolean `json:"isAdminEnforced,omitempty"` // Are status checks required to update matching branches. (Optional.) @@ -325,14 +453,41 @@ type CreateBranchProtectionRuleInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } -// CreateContentAttachmentInput is an autogenerated input type of CreateContentAttachment. -type CreateContentAttachmentInput struct { - // The node ID of the content_reference. (Required.) - ContentReferenceID ID `json:"contentReferenceId"` - // The title of the content attachment. (Required.) - Title String `json:"title"` - // The body of the content attachment, which may contain markdown. (Required.) - Body String `json:"body"` +// CreateCheckRunInput is an autogenerated input type of CreateCheckRun. +type CreateCheckRunInput struct { + // The node ID of the repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // The name of the check. (Required.) + Name String `json:"name"` + // The SHA of the head commit. (Required.) + HeadSha GitObjectID `json:"headSha"` + + // The URL of the integrator's site that has the full details of the check. (Optional.) + DetailsURL *URI `json:"detailsUrl,omitempty"` + // A reference for the run on the integrator's system. (Optional.) + ExternalID *String `json:"externalId,omitempty"` + // The current status. (Optional.) + Status *RequestableCheckStatusState `json:"status,omitempty"` + // The time that the check run began. (Optional.) + StartedAt *DateTime `json:"startedAt,omitempty"` + // The final conclusion of the check. (Optional.) + Conclusion *CheckConclusionState `json:"conclusion,omitempty"` + // The time that the check run finished. (Optional.) + CompletedAt *DateTime `json:"completedAt,omitempty"` + // Descriptive details about the run. (Optional.) + Output *CheckRunOutput `json:"output,omitempty"` + // Possible further actions the integrator can perform, which a user may trigger. (Optional.) + Actions *[]CheckRunAction `json:"actions,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// CreateCheckSuiteInput is an autogenerated input type of CreateCheckSuite. +type CreateCheckSuiteInput struct { + // The Node ID of the repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // The SHA of the head commit. (Required.) + HeadSha GitObjectID `json:"headSha"` // A unique identifier for the client performing the mutation. (Optional.) ClientMutationID *String `json:"clientMutationId,omitempty"` @@ -355,6 +510,21 @@ type CreateEnterpriseOrganizationInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// CreateIpAllowListEntryInput is an autogenerated input type of CreateIpAllowListEntry. +type CreateIpAllowListEntryInput struct { + // The ID of the owner for which to create the new IP allow list entry. (Required.) + OwnerID ID `json:"ownerId"` + // An IP address or range of addresses in CIDR notation. (Required.) + AllowListValue String `json:"allowListValue"` + // Whether the IP allow list entry is active when an IP allow list is enabled. (Required.) + IsActive Boolean `json:"isActive"` + + // An optional name for the IP allow list entry. (Optional.) + Name *String `json:"name,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // CreateIssueInput is an autogenerated input type of CreateIssue. type CreateIssueInput struct { // The Node ID of the repository. (Required.) @@ -372,6 +542,8 @@ type CreateIssueInput struct { LabelIDs *[]ID `json:"labelIds,omitempty"` // An array of Node IDs for projects associated with this issue. (Optional.) ProjectIDs *[]ID `json:"projectIds,omitempty"` + // The name of an issue template in the repository, assigns labels and assignees from the template to the issue. (Optional.) + IssueTemplate *String `json:"issueTemplate,omitempty"` // A unique identifier for the client performing the mutation. (Optional.) ClientMutationID *String `json:"clientMutationId,omitempty"` } @@ -408,6 +580,8 @@ type CreatePullRequestInput struct { Body *String `json:"body,omitempty"` // Indicates whether maintainers can modify the pull request. (Optional.) MaintainerCanModify *Boolean `json:"maintainerCanModify,omitempty"` + // Indicates whether this pull request should be a draft. (Optional.) + Draft *Boolean `json:"draft,omitempty"` // A unique identifier for the client performing the mutation. (Optional.) ClientMutationID *String `json:"clientMutationId,omitempty"` } @@ -498,6 +672,24 @@ type DeleteBranchProtectionRuleInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// DeleteDeploymentInput is an autogenerated input type of DeleteDeployment. +type DeleteDeploymentInput struct { + // The Node ID of the deployment to be deleted. (Required.) + ID ID `json:"id"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// DeleteIpAllowListEntryInput is an autogenerated input type of DeleteIpAllowListEntry. +type DeleteIpAllowListEntryInput struct { + // The ID of the IP allow list entry to delete. (Required.) + IPAllowListEntryID ID `json:"ipAllowListEntryId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // DeleteIssueCommentInput is an autogenerated input type of DeleteIssueComment. type DeleteIssueCommentInput struct { // The ID of the comment to delete. (Required.) @@ -516,15 +708,6 @@ type DeleteIssueInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } -// DeletePackageVersionInput is an autogenerated input type of DeletePackageVersion. -type DeletePackageVersionInput struct { - // The ID of the package version to be deleted. (Required.) - PackageVersionID ID `json:"packageVersionId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - // DeleteProjectCardInput is an autogenerated input type of DeleteProjectCard. type DeleteProjectCardInput struct { // The id of the card to delete. (Required.) @@ -626,6 +809,23 @@ type DraftPullRequestReviewComment struct { Body String `json:"body"` } +// DraftPullRequestReviewThread specifies a review comment thread to be left with a Pull Request Review. +type DraftPullRequestReviewThread struct { + // Path to the file being commented on. (Required.) + Path String `json:"path"` + // The line of the blob to which the thread refers. The end of the line range for multi-line comments. (Required.) + Line Int `json:"line"` + // Body of the comment to leave. (Required.) + Body String `json:"body"` + + // The side of the diff on which the line resides. For multi-line comments, this is the side for the end of the line range. (Optional.) + Side *DiffSide `json:"side,omitempty"` + // The first line of the range to which the comment refers. (Optional.) + StartLine *Int `json:"startLine,omitempty"` + // The side of the diff on which the start line resides. (Optional.) + StartSide *DiffSide `json:"startSide,omitempty"` +} + // EnterpriseAdministratorInvitationOrder represents ordering options for enterprise administrator invitation connections. type EnterpriseAdministratorInvitationOrder struct { // The field to order enterprise administrator invitations by. (Required.) @@ -642,14 +842,6 @@ type EnterpriseMemberOrder struct { Direction OrderDirection `json:"direction"` } -// EnterpriseOrder represents ordering options for enterprises. -type EnterpriseOrder struct { - // The field to order enterprises by. (Required.) - Field EnterpriseOrderField `json:"field"` - // The ordering direction. (Required.) - Direction OrderDirection `json:"direction"` -} - // EnterpriseServerInstallationOrder represents ordering options for Enterprise Server installation connections. type EnterpriseServerInstallationOrder struct { // The field to order Enterprise Server installations by. (Required.) @@ -699,23 +891,6 @@ type GistOrder struct { Direction OrderDirection `json:"direction"` } -// ImportProjectInput is an autogenerated input type of ImportProject. -type ImportProjectInput struct { - // The name of the Organization or User to create the Project under. (Required.) - OwnerName String `json:"ownerName"` - // The name of Project. (Required.) - Name String `json:"name"` - // A list of columns containing issues and pull requests. (Required.) - ColumnImports []ProjectColumnImport `json:"columnImports"` - - // The description of Project. (Optional.) - Body *String `json:"body,omitempty"` - // Whether the Project is public or not. (Optional.) - Public *Boolean `json:"public,omitempty"` - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - // InviteEnterpriseAdminInput is an autogenerated input type of InviteEnterpriseAdmin. type InviteEnterpriseAdminInput struct { // The ID of the enterprise to which you want to invite an administrator. (Required.) @@ -731,6 +906,22 @@ type InviteEnterpriseAdminInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// IpAllowListEntryOrder represents ordering options for IP allow list entry connections. +type IpAllowListEntryOrder struct { + // The field to order IP allow list entries by. (Required.) + Field IpAllowListEntryOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + +// IssueCommentOrder represents ways in which lists of issue comments can be ordered upon return. +type IssueCommentOrder struct { + // The field in which to order issue comments by. (Required.) + Field IssueCommentOrderField `json:"field"` + // The direction in which to order issue comments by the specified field. (Required.) + Direction OrderDirection `json:"direction"` +} + // IssueFilters represents ways in which to filter lists of issues. type IssueFilters struct { @@ -760,6 +951,14 @@ type IssueOrder struct { Direction OrderDirection `json:"direction"` } +// LabelOrder represents ways in which lists of labels can be ordered upon return. +type LabelOrder struct { + // The field in which to order labels by. (Required.) + Field LabelOrderField `json:"field"` + // The direction in which to order labels by the specified field. (Required.) + Direction OrderDirection `json:"direction"` +} + // LanguageOrder represents ordering options for language connections. type LanguageOrder struct { // The field to order languages by. (Required.) @@ -781,15 +980,35 @@ type LinkRepositoryToProjectInput struct { // LockLockableInput is an autogenerated input type of LockLockable. type LockLockableInput struct { - // ID of the issue or pull request to be locked. (Required.) + // ID of the item to be locked. (Required.) LockableID ID `json:"lockableId"` - // A reason for why the issue or pull request will be locked. (Optional.) + // A reason for why the item will be locked. (Optional.) LockReason *LockReason `json:"lockReason,omitempty"` // A unique identifier for the client performing the mutation. (Optional.) ClientMutationID *String `json:"clientMutationId,omitempty"` } +// MarkFileAsViewedInput is an autogenerated input type of MarkFileAsViewed. +type MarkFileAsViewedInput struct { + // The Node ID of the pull request. (Required.) + PullRequestID ID `json:"pullRequestId"` + // The path of the file to mark as viewed. (Required.) + Path String `json:"path"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// MarkPullRequestReadyForReviewInput is an autogenerated input type of MarkPullRequestReadyForReview. +type MarkPullRequestReadyForReviewInput struct { + // ID of the pull request to be marked as ready for review. (Required.) + PullRequestID ID `json:"pullRequestId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // MergeBranchInput is an autogenerated input type of MergeBranch. type MergeBranchInput struct { // The Node ID of the Repository containing the base branch that will be modified. (Required.) @@ -801,6 +1020,8 @@ type MergeBranchInput struct { // Message to use for the merge commit. If omitted, a default will be used. (Optional.) CommitMessage *String `json:"commitMessage,omitempty"` + // The email address to associate with this commit. (Optional.) + AuthorEmail *String `json:"authorEmail,omitempty"` // A unique identifier for the client performing the mutation. (Optional.) ClientMutationID *String `json:"clientMutationId,omitempty"` } @@ -818,6 +1039,8 @@ type MergePullRequestInput struct { ExpectedHeadOid *GitObjectID `json:"expectedHeadOid,omitempty"` // The merge method to use. If omitted, defaults to 'MERGE'. (Optional.) MergeMethod *PullRequestMergeMethod `json:"mergeMethod,omitempty"` + // The email address to associate with this merge. (Optional.) + AuthorEmail *String `json:"authorEmail,omitempty"` // A unique identifier for the client performing the mutation. (Optional.) ClientMutationID *String `json:"clientMutationId,omitempty"` } @@ -873,32 +1096,31 @@ type OrganizationOrder struct { Direction OrderDirection `json:"direction"` } -// PinIssueInput is an autogenerated input type of PinIssue. -type PinIssueInput struct { - // The ID of the issue to be pinned. (Required.) - IssueID ID `json:"issueId"` +// PackageFileOrder represents ways in which lists of package files can be ordered upon return. +type PackageFileOrder struct { - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` + // The field in which to order package files by. (Optional.) + Field *PackageFileOrderField `json:"field,omitempty"` + // The direction in which to order package files by the specified field. (Optional.) + Direction *OrderDirection `json:"direction,omitempty"` } -// ProjectCardImport represents an issue or PR and its owning repository to be used in a project card. -type ProjectCardImport struct { - // Repository name with owner (owner/repository). (Required.) - Repository String `json:"repository"` - // The issue or pull request number. (Required.) - Number Int `json:"number"` +// PackageOrder represents ways in which lists of packages can be ordered upon return. +type PackageOrder struct { + + // The field in which to order packages by. (Optional.) + Field *PackageOrderField `json:"field,omitempty"` + // The direction in which to order packages by the specified field. (Optional.) + Direction *OrderDirection `json:"direction,omitempty"` } -// ProjectColumnImport represents a project column and a list of its issues and PRs. -type ProjectColumnImport struct { - // The name of the column. (Required.) - ColumnName String `json:"columnName"` - // The position of the column, starting from 0. (Required.) - Position Int `json:"position"` +// PackageVersionOrder represents ways in which lists of package versions can be ordered upon return. +type PackageVersionOrder struct { - // A list of issues and pull requests in the column. (Optional.) - Issues *[]ProjectCardImport `json:"issues,omitempty"` + // The field in which to order package versions by. (Optional.) + Field *PackageVersionOrderField `json:"field,omitempty"` + // The direction in which to order package versions by the specified field. (Optional.) + Direction *OrderDirection `json:"direction,omitempty"` } // ProjectOrder represents ways in which lists of projects can be ordered upon return. @@ -942,17 +1164,6 @@ type RegenerateEnterpriseIdentityProviderRecoveryCodesInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } -// RegistryPackageMetadatum represents represents a single registry metadatum. -type RegistryPackageMetadatum struct { - // Name of the metadatum. (Required.) - Name String `json:"name"` - // Value of the metadatum. (Required.) - Value String `json:"value"` - - // True, if the metadatum can be updated if it already exists. (Optional.) - Update *Boolean `json:"update,omitempty"` -} - // ReleaseOrder represents ways in which lists of releases can be ordered upon return. type ReleaseOrder struct { // The field in which to order releases by. (Required.) @@ -983,6 +1194,15 @@ type RemoveEnterpriseAdminInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// RemoveEnterpriseIdentityProviderInput is an autogenerated input type of RemoveEnterpriseIdentityProvider. +type RemoveEnterpriseIdentityProviderInput struct { + // The ID of the enterprise from which to remove the identity provider. (Required.) + EnterpriseID ID `json:"enterpriseId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // RemoveEnterpriseOrganizationInput is an autogenerated input type of RemoveEnterpriseOrganization. type RemoveEnterpriseOrganizationInput struct { // The ID of the enterprise from which the organization should be removed. (Required.) @@ -1085,6 +1305,17 @@ type RequestReviewsInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// RerequestCheckSuiteInput is an autogenerated input type of RerequestCheckSuite. +type RerequestCheckSuiteInput struct { + // The Node ID of the repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // The Node ID of the check suite. (Required.) + CheckSuiteID ID `json:"checkSuiteId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // ResolveReviewThreadInput is an autogenerated input type of ResolveReviewThread. type ResolveReviewThreadInput struct { // The ID of the thread to resolve. (Required.) @@ -1126,6 +1357,64 @@ type SecurityVulnerabilityOrder struct { Direction OrderDirection `json:"direction"` } +// SetEnterpriseIdentityProviderInput is an autogenerated input type of SetEnterpriseIdentityProvider. +type SetEnterpriseIdentityProviderInput struct { + // The ID of the enterprise on which to set an identity provider. (Required.) + EnterpriseID ID `json:"enterpriseId"` + // The URL endpoint for the identity provider's SAML SSO. (Required.) + SsoURL URI `json:"ssoUrl"` + // The x509 certificate used by the identity provider to sign assertions and responses. (Required.) + IdpCertificate String `json:"idpCertificate"` + // The signature algorithm used to sign SAML requests for the identity provider. (Required.) + SignatureMethod SamlSignatureAlgorithm `json:"signatureMethod"` + // The digest algorithm used to sign SAML requests for the identity provider. (Required.) + DigestMethod SamlDigestAlgorithm `json:"digestMethod"` + + // The Issuer Entity ID for the SAML identity provider. (Optional.) + Issuer *String `json:"issuer,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// SetOrganizationInteractionLimitInput is an autogenerated input type of SetOrganizationInteractionLimit. +type SetOrganizationInteractionLimitInput struct { + // The ID of the organization to set a limit for. (Required.) + OrganizationID ID `json:"organizationId"` + // The limit to set. (Required.) + Limit RepositoryInteractionLimit `json:"limit"` + + // When this limit should expire. (Optional.) + Expiry *RepositoryInteractionLimitExpiry `json:"expiry,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// SetRepositoryInteractionLimitInput is an autogenerated input type of SetRepositoryInteractionLimit. +type SetRepositoryInteractionLimitInput struct { + // The ID of the repository to set a limit for. (Required.) + RepositoryID ID `json:"repositoryId"` + // The limit to set. (Required.) + Limit RepositoryInteractionLimit `json:"limit"` + + // When this limit should expire. (Optional.) + Expiry *RepositoryInteractionLimitExpiry `json:"expiry,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// SetUserInteractionLimitInput is an autogenerated input type of SetUserInteractionLimit. +type SetUserInteractionLimitInput struct { + // The ID of the user to set a limit for. (Required.) + UserID ID `json:"userId"` + // The limit to set. (Required.) + Limit RepositoryInteractionLimit `json:"limit"` + + // When this limit should expire. (Optional.) + Expiry *RepositoryInteractionLimitExpiry `json:"expiry,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // SponsorsTierOrder represents ordering options for Sponsors tiers connections. type SponsorsTierOrder struct { // The field to order tiers by. (Required.) @@ -1152,11 +1441,13 @@ type StarOrder struct { // SubmitPullRequestReviewInput is an autogenerated input type of SubmitPullRequestReview. type SubmitPullRequestReviewInput struct { - // The Pull Request Review ID to submit. (Required.) - PullRequestReviewID ID `json:"pullRequestReviewId"` // The event to send to the Pull Request Review. (Required.) Event PullRequestReviewEvent `json:"event"` + // The Pull Request ID to submit any pending reviews. (Optional.) + PullRequestID *ID `json:"pullRequestId,omitempty"` + // The Pull Request Review ID to submit. (Optional.) + PullRequestReviewID *ID `json:"pullRequestReviewId,omitempty"` // The text field to set on the Pull Request Review. (Optional.) Body *String `json:"body,omitempty"` // A unique identifier for the client performing the mutation. (Optional.) @@ -1245,13 +1536,24 @@ type UnlinkRepositoryFromProjectInput struct { // UnlockLockableInput is an autogenerated input type of UnlockLockable. type UnlockLockableInput struct { - // ID of the issue or pull request to be unlocked. (Required.) + // ID of the item to be unlocked. (Required.) LockableID ID `json:"lockableId"` // A unique identifier for the client performing the mutation. (Optional.) ClientMutationID *String `json:"clientMutationId,omitempty"` } +// UnmarkFileAsViewedInput is an autogenerated input type of UnmarkFileAsViewed. +type UnmarkFileAsViewedInput struct { + // The Node ID of the pull request. (Required.) + PullRequestID ID `json:"pullRequestId"` + // The path of the file to mark as unviewed. (Required.) + Path String `json:"path"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // UnmarkIssueAsDuplicateInput is an autogenerated input type of UnmarkIssueAsDuplicate. type UnmarkIssueAsDuplicateInput struct { // ID of the issue or pull request currently marked as a duplicate. (Required.) @@ -1272,15 +1574,6 @@ type UnminimizeCommentInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } -// UnpinIssueInput is an autogenerated input type of UnpinIssue. -type UnpinIssueInput struct { - // The ID of the issue to be unpinned. (Required.) - IssueID ID `json:"issueId"` - - // A unique identifier for the client performing the mutation. (Optional.) - ClientMutationID *String `json:"clientMutationId,omitempty"` -} - // UnresolveReviewThreadInput is an autogenerated input type of UnresolveReviewThread. type UnresolveReviewThreadInput struct { // The ID of the thread to unresolve. (Required.) @@ -1303,6 +1596,12 @@ type UpdateBranchProtectionRuleInput struct { RequiredApprovingReviewCount *Int `json:"requiredApprovingReviewCount,omitempty"` // Are commits required to be signed. (Optional.) RequiresCommitSignatures *Boolean `json:"requiresCommitSignatures,omitempty"` + // Are merge commits prohibited from being pushed to this branch. (Optional.) + RequiresLinearHistory *Boolean `json:"requiresLinearHistory,omitempty"` + // Are force pushes allowed on this branch. (Optional.) + AllowsForcePushes *Boolean `json:"allowsForcePushes,omitempty"` + // Can this branch be deleted. (Optional.) + AllowsDeletions *Boolean `json:"allowsDeletions,omitempty"` // Can admins overwrite branch protection. (Optional.) IsAdminEnforced *Boolean `json:"isAdminEnforced,omitempty"` // Are status checks required to update matching branches. (Optional.) @@ -1327,12 +1626,41 @@ type UpdateBranchProtectionRuleInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } -// UpdateEnterpriseActionExecutionCapabilitySettingInput is an autogenerated input type of UpdateEnterpriseActionExecutionCapabilitySetting. -type UpdateEnterpriseActionExecutionCapabilitySettingInput struct { - // The ID of the enterprise on which to set the members can create repositories setting. (Required.) - EnterpriseID ID `json:"enterpriseId"` - // The value for the action execution capability setting on the enterprise. (Required.) - Capability ActionExecutionCapabilitySetting `json:"capability"` +// UpdateCheckRunInput is an autogenerated input type of UpdateCheckRun. +type UpdateCheckRunInput struct { + // The node ID of the repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // The node of the check. (Required.) + CheckRunID ID `json:"checkRunId"` + + // The name of the check. (Optional.) + Name *String `json:"name,omitempty"` + // The URL of the integrator's site that has the full details of the check. (Optional.) + DetailsURL *URI `json:"detailsUrl,omitempty"` + // A reference for the run on the integrator's system. (Optional.) + ExternalID *String `json:"externalId,omitempty"` + // The current status. (Optional.) + Status *RequestableCheckStatusState `json:"status,omitempty"` + // The time that the check run began. (Optional.) + StartedAt *DateTime `json:"startedAt,omitempty"` + // The final conclusion of the check. (Optional.) + Conclusion *CheckConclusionState `json:"conclusion,omitempty"` + // The time that the check run finished. (Optional.) + CompletedAt *DateTime `json:"completedAt,omitempty"` + // Descriptive details about the run. (Optional.) + Output *CheckRunOutput `json:"output,omitempty"` + // Possible further actions the integrator can perform, which a user may trigger. (Optional.) + Actions *[]CheckRunAction `json:"actions,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateCheckSuitePreferencesInput is an autogenerated input type of UpdateCheckSuitePreferences. +type UpdateCheckSuitePreferencesInput struct { + // The Node ID of the repository. (Required.) + RepositoryID ID `json:"repositoryId"` + // The check suite preferences to modify. (Required.) + AutoTriggerPreferences []CheckSuiteAutoTriggerPreference `json:"autoTriggerPreferences"` // A unique identifier for the client performing the mutation. (Optional.) ClientMutationID *String `json:"clientMutationId,omitempty"` @@ -1530,6 +1858,32 @@ type UpdateEnterpriseTwoFactorAuthenticationRequiredSettingInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// UpdateIpAllowListEnabledSettingInput is an autogenerated input type of UpdateIpAllowListEnabledSetting. +type UpdateIpAllowListEnabledSettingInput struct { + // The ID of the owner on which to set the IP allow list enabled setting. (Required.) + OwnerID ID `json:"ownerId"` + // The value for the IP allow list enabled setting. (Required.) + SettingValue IpAllowListEnabledSettingValue `json:"settingValue"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdateIpAllowListEntryInput is an autogenerated input type of UpdateIpAllowListEntry. +type UpdateIpAllowListEntryInput struct { + // The ID of the IP allow list entry to update. (Required.) + IPAllowListEntryID ID `json:"ipAllowListEntryId"` + // An IP address or range of addresses in CIDR notation. (Required.) + AllowListValue String `json:"allowListValue"` + // Whether the IP allow list entry is active when an IP allow list is enabled. (Required.) + IsActive Boolean `json:"isActive"` + + // An optional name for the IP allow list entry. (Optional.) + Name *String `json:"name,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // UpdateIssueCommentInput is an autogenerated input type of UpdateIssueComment. type UpdateIssueCommentInput struct { // The ID of the IssueComment to modify. (Required.) diff --git a/vendor/modules.txt b/vendor/modules.txt index a8312c65e5..73d13f6b57 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -364,7 +364,7 @@ github.com/ryancurrah/gomodguard # github.com/securego/gosec v0.0.0-20200316084457-7da9f46445fd github.com/securego/gosec github.com/securego/gosec/rules -# github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0 +# github.com/shurcooL/githubv4 v0.0.0-20201206200315-234843c633fa github.com/shurcooL/githubv4 # github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f github.com/shurcooL/graphql diff --git a/website/docs/r/branch_protection.html.markdown b/website/docs/r/branch_protection.html.markdown index c74fac620a..ef63393ed5 100644 --- a/website/docs/r/branch_protection.html.markdown +++ b/website/docs/r/branch_protection.html.markdown @@ -24,8 +24,9 @@ resource "github_branch_protection" "example" { # also accepts repository name # repository_id = github_repository.example.name - pattern = "main" - enforce_admins = true + pattern = "main" + enforce_admins = true + allows_deletions = true required_status_checks { strict = false @@ -74,6 +75,8 @@ The following arguments are supported: * `required_status_checks` - (Optional) Enforce restrictions for required status checks. See [Required Status Checks](#required-status-checks) below for details. * `required_pull_request_reviews` - (Optional) Enforce restrictions for pull request reviews. See [Required Pull Request Reviews](#required-pull-request-reviews) below for details. * `push_restrictions` - (Optional) The list of actor IDs that may push to the branch. +* `allows_deletions` - (Optional) Boolean, setting this to `true` to allow the branch to be deleted. +* `allows_force_pushes` - (Optional) Boolean, setting this to `true` to allow force pushes on the branch. ### Required Status Checks From 5863a2b65b9f3008129785aa4bbb0ba334c87fd8 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Wed, 23 Dec 2020 20:37:22 -0500 Subject: [PATCH 08/45] Fix syntax error --- github/resource_github_repository.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/resource_github_repository.go b/github/resource_github_repository.go index 275d945eb0..115cd4029e 100644 --- a/github/resource_github_repository.go +++ b/github/resource_github_repository.go @@ -106,7 +106,7 @@ func resourceGithubRepository() *schema.Resource { }, "license_template": { Type: schema.TypeString, - Optional: true + Optional: true, }, "gitignore_template": { Type: schema.TypeString, From f88876b61b660352116764fdcdd90d7407396877 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Thu, 24 Dec 2020 09:42:18 -0500 Subject: [PATCH 09/45] Conditionally Run GHES Test Suite --- .github/workflows/ghes-acceptance-tests-all.yml | 16 ++++++++++++++++ .github/workflows/ghes-acceptance-tests.yml | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/.github/workflows/ghes-acceptance-tests-all.yml b/.github/workflows/ghes-acceptance-tests-all.yml index d27e571ea3..7dc2dc07e8 100644 --- a/.github/workflows/ghes-acceptance-tests-all.yml +++ b/.github/workflows/ghes-acceptance-tests-all.yml @@ -11,8 +11,20 @@ on: - cron: '0 0 * * *' jobs: + runtime: + runs-on: ubuntu-latest + steps: + - name: Query server address + id: server-address + run: | + SERVER_ADDRESS=$(dig +short terraformtesting-ghe.eastus.cloudapp.azure.com) + echo "::set-output name=server-address::${SERVER_ADDRESS}" + outputs: + server-address: ${{ steps.server-address.outputs.server-address }} acceptance-tests-anonymous: + needs: [runtime] + if: ${{ needs.runtime.outputs.server-address != '255.255.255.255' }} runs-on: ubuntu-latest steps: - name: Checkout @@ -26,6 +38,8 @@ jobs: GITHUB_BASE_URL: "https://terraformtesting-ghe.eastus.cloudapp.azure.com/" acceptance-tests-individual: + needs: [runtime] + if: ${{ needs.runtime.outputs.server-address != '255.255.255.255' }} runs-on: ubuntu-latest steps: - name: Checkout @@ -55,6 +69,8 @@ jobs: GITHUB_TEST_USER_TOKEN: ${{ secrets.GHES_TEST_USER_TOKEN }} acceptance-tests-organization: + needs: [runtime] + if: ${{ needs.runtime.outputs.server-address != '255.255.255.255' }} runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/ghes-acceptance-tests.yml b/.github/workflows/ghes-acceptance-tests.yml index 3c80fcee19..287259f5cd 100644 --- a/.github/workflows/ghes-acceptance-tests.yml +++ b/.github/workflows/ghes-acceptance-tests.yml @@ -6,8 +6,20 @@ on: - test/** jobs: + runtime: + runs-on: ubuntu-latest + steps: + - name: Query server address + id: server-address + run: | + SERVER_ADDRESS=$(dig +short terraformtesting-ghe.eastus.cloudapp.azure.com) + echo "::set-output name=server-address::${SERVER_ADDRESS}" + outputs: + server-address: ${{ steps.server-address.outputs.server-address }} acceptance-tests-anonymous: + needs: [runtime] + if: ${{ needs.runtime.outputs.server-address != '255.255.255.255' }} runs-on: ubuntu-latest steps: - name: Checkout @@ -21,6 +33,8 @@ jobs: GITHUB_BASE_URL: "https://terraformtesting-ghe.eastus.cloudapp.azure.com/" acceptance-tests-individual: + needs: [runtime] + if: ${{ needs.runtime.outputs.server-address != '255.255.255.255' }} runs-on: ubuntu-latest steps: - name: Checkout @@ -36,6 +50,8 @@ jobs: GITHUB_TEST_USER_TOKEN: ${{ secrets.GHES_TEST_USER_TOKEN }} acceptance-tests-organization: + needs: [runtime] + if: ${{ needs.runtime.outputs.server-address != '255.255.255.255' }} runs-on: ubuntu-latest steps: - name: Checkout From 87b0c75ead95d133851ab9055d513203c394a506 Mon Sep 17 00:00:00 2001 From: Stephen Hoekstra Date: Thu, 7 Jan 2021 15:15:31 +0100 Subject: [PATCH 10/45] Run gofmt (#645) Signed-off-by: Stephen Hoekstra --- github/resource_github_branch_protection.go | 4 ++-- github/util_v4_branch_protection.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/github/resource_github_branch_protection.go b/github/resource_github_branch_protection.go index b98dddea1c..5e74306830 100644 --- a/github/resource_github_branch_protection.go +++ b/github/resource_github_branch_protection.go @@ -76,8 +76,8 @@ func resourceGithubBranchProtection() *schema.Resource { }, }, PROTECTION_REQUIRES_STATUS_CHECKS: { - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, DiffSuppressFunc: statusChecksDiffSuppression, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ diff --git a/github/util_v4_branch_protection.go b/github/util_v4_branch_protection.go index ad2587098b..ad4f880fea 100644 --- a/github/util_v4_branch_protection.go +++ b/github/util_v4_branch_protection.go @@ -22,7 +22,7 @@ type DismissalActorTypes struct { type PushActorTypes struct { Actor struct { - App Actor `graphql:"... on App"` + App Actor `graphql:"... on App"` Team Actor `graphql:"... on Team"` User Actor `graphql:"... on User"` } From e0dd312733c2efb0d127b70d1ef475f22ceec8ea Mon Sep 17 00:00:00 2001 From: John Losito Date: Thu, 7 Jan 2021 09:16:27 -0500 Subject: [PATCH 11/45] Allow dependabot to check github actions (#643) --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..5ace4600a1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From eb0948c1da90e0da233e6fd9b7e8bae062e869d4 Mon Sep 17 00:00:00 2001 From: Bret <166301+bcomnes@users.noreply.github.com> Date: Thu, 7 Jan 2021 07:17:15 -0700 Subject: [PATCH 12/45] Typo: s/visiblity/visibility (#629) Small typo in the docs. --- website/docs/r/actions_organization_secret.html.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/website/docs/r/actions_organization_secret.html.markdown b/website/docs/r/actions_organization_secret.html.markdown index 34471b2b23..60e79258ba 100644 --- a/website/docs/r/actions_organization_secret.html.markdown +++ b/website/docs/r/actions_organization_secret.html.markdown @@ -23,9 +23,9 @@ in your code. See below for an example of this abstraction. ```hcl resource "github_actions_organization_secret" "example_secret" { - secret_name = "example_secret_name" - visiblity = "private" - plaintext_value = var.some_secret_string + secret_name = "example_secret_name" + visibility = "private" + plaintext_value = var.some_secret_string } ``` @@ -36,7 +36,7 @@ data "github_repository" "repo" { resource "github_actions_organization_secret" "example_secret" { secret_name = "example_secret_name" - visiblity = "selected" + visibility = "selected" plaintext_value = var.some_secret_string selected_repository_ids = [data.github_repository.repo.repo_id] } From 2e5e268119158f802393ce6810d1cc92f8db4b26 Mon Sep 17 00:00:00 2001 From: Jakub Holy Date: Thu, 7 Jan 2021 15:17:59 +0100 Subject: [PATCH 13/45] github_repository_webhook: describe content_type options (#510) --- website/docs/r/repository_webhook.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/repository_webhook.html.markdown b/website/docs/r/repository_webhook.html.markdown index b44de9ff42..d0c09b72c9 100644 --- a/website/docs/r/repository_webhook.html.markdown +++ b/website/docs/r/repository_webhook.html.markdown @@ -46,7 +46,7 @@ The following arguments are supported: * `events` - (Required) A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/). -* `configuration` - (Required) key/value pair of configuration for this webhook. Available keys are `url`, `content_type`, `secret` and `insecure_ssl`. `secret` is [the shared secret, see API documentation](https://developer.github.com/v3/repos/hooks/#create-a-hook). +* `configuration` - (Required) key/value pair of configuration for this webhook. Available keys are `url`, `content_type`, `secret` and `insecure_ssl`. `secret` is [the shared secret, see API documentation](https://developer.github.com/v3/repos/hooks/#create-a-hook). `content_type` may be either form or json. * `active` - (Optional) Indicate of the webhook should receive events. Defaults to `true`. From 3862f96ece12105f8d6757836655071b8ed1a052 Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Thu, 7 Jan 2021 23:19:51 +0900 Subject: [PATCH 14/45] change private to visibility (#635) --- examples/repository_collaborator/main.tf | 2 +- examples/repository_delete_branch_on_merge/main.tf | 2 +- website/docs/r/branch_default.html.markdown | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/repository_collaborator/main.tf b/examples/repository_collaborator/main.tf index 5b0718e6a5..a792af303b 100644 --- a/examples/repository_collaborator/main.tf +++ b/examples/repository_collaborator/main.tf @@ -1,6 +1,6 @@ resource "github_repository" "collaboration" { name = "collaboration" - private = true + visibility = "private" description = "A collaborative repository" } diff --git a/examples/repository_delete_branch_on_merge/main.tf b/examples/repository_delete_branch_on_merge/main.tf index 82a99b1b71..92e7706294 100644 --- a/examples/repository_delete_branch_on_merge/main.tf +++ b/examples/repository_delete_branch_on_merge/main.tf @@ -2,6 +2,6 @@ resource "github_repository" "delete_branch_on_merge" { name = "delete_branch_on_merge" description = "A repository with delete-branch-on-merge configured" default_branch = "main" - private = true + visibility = "private" delete_branch_on_merge = true } diff --git a/website/docs/r/branch_default.html.markdown b/website/docs/r/branch_default.html.markdown index d9885c1b6b..cfc11623ce 100644 --- a/website/docs/r/branch_default.html.markdown +++ b/website/docs/r/branch_default.html.markdown @@ -18,7 +18,7 @@ resource "github_repository" "example" { name = "example" description = "My awesome codebase" - private = true + visibility = "private" template { owner = "github" From ce15a112bd91db6b0965124046e0c717f3ca1dbd Mon Sep 17 00:00:00 2001 From: Stephen Hoekstra Date: Thu, 7 Jan 2021 17:05:24 +0100 Subject: [PATCH 15/45] Use commit SHA to lookup commit info in github_repository_file resource (#644) * Fix references to "master" Signed-off-by: Stephen Hoekstra * Use commit SHA to lookup commit info Currently the provider loops through commits in a repo until it finds the most recent commit containing the managed file. This is inefficient and could lead to you being rate limited if managing a few files that were updated a long time ago. This commit fixes that by storing the commit SHA when updating the file and using that SHA to lookup the commit info instead of looping through all commits. Signed-off-by: Stephen Hoekstra --- github/resource_github_repository_file.go | 33 +++++++++++++++---- .../resource_github_repository_file_test.go | 24 ++++++++++++++ website/docs/r/repository_file.html.markdown | 6 ++-- 3 files changed, 54 insertions(+), 9 deletions(-) diff --git a/github/resource_github_repository_file.go b/github/resource_github_repository_file.go index 62ec015f21..87cd695691 100644 --- a/github/resource_github_repository_file.go +++ b/github/resource_github_repository_file.go @@ -24,7 +24,7 @@ func resourceGithubRepositoryFile() *schema.Resource { branch := "main" if len(parts) > 2 { - return nil, fmt.Errorf("Invalid ID specified. Supplied ID must be written as / (when branch is \"master\") or /:") + return nil, fmt.Errorf("Invalid ID specified. Supplied ID must be written as / (when branch is \"main\") or /:") } if len(parts) == 2 { @@ -68,9 +68,14 @@ func resourceGithubRepositoryFile() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, - Description: "The branch name, defaults to \"master\"", + Description: "The branch name, defaults to \"main\"", Default: "main", }, + "commit_sha": { + Type: schema.TypeString, + Computed: true, + Description: "The SHA of the commit that modified the file", + }, "commit_message": { Type: schema.TypeString, Optional: true, @@ -193,12 +198,13 @@ func resourceGithubRepositoryFileCreate(d *schema.ResourceData, meta interface{} // Create a new or overwritten file log.Printf("[DEBUG] Creating repository file: %s/%s/%s in branch: %s", owner, repo, file, branch) - _, _, err = client.Repositories.CreateFile(ctx, owner, repo, file, opts) + create, _, err := client.Repositories.CreateFile(ctx, owner, repo, file, opts) if err != nil { return err } d.SetId(fmt.Sprintf("%s/%s", repo, file)) + d.Set("commit", create.Commit.GetSHA()) return resourceGithubRepositoryFileRead(d, meta) } @@ -237,13 +243,24 @@ func resourceGithubRepositoryFileRead(d *schema.ResourceData, meta interface{}) d.Set("sha", fc.GetSHA()) log.Printf("[DEBUG] Fetching commit info for repository file: %s/%s/%s", owner, repo, file) - commit, err := getFileCommit(client, owner, repo, file, branch) + var commit *github.RepositoryCommit + + // Use the SHA to lookup the commit info if we know it, otherwise loop through commits + if sha, ok := d.GetOk("commit_sha"); ok { + log.Printf("[DEBUG] Using known commit SHA: %s", sha.(string)) + commit, _, err = client.Repositories.GetCommit(ctx, owner, repo, sha.(string)) + } else { + log.Printf("[DEBUG] Commit SHA unknown for file: %s/%s/%s, looking for commit...", owner, repo, file) + commit, err = getFileCommit(client, owner, repo, file, branch) + log.Printf("[DEBUG] Found file: %s/%s/%s, in commit SHA: %s ", owner, repo, file, commit.GetSHA()) + } if err != nil { return err } - d.Set("commit_author", commit.GetCommit().GetCommitter().GetName()) - d.Set("commit_email", commit.GetCommit().GetCommitter().GetEmail()) + d.Set("commit_sha", commit.GetSHA()) + d.Set("commit_author", commit.GetCommitter().GetName()) + d.Set("commit_email", commit.GetCommitter().GetEmail()) d.Set("commit_message", commit.GetCommit().GetMessage()) return nil @@ -274,11 +291,13 @@ func resourceGithubRepositoryFileUpdate(d *schema.ResourceData, meta interface{} } log.Printf("[DEBUG] Updating content in repository file: %s/%s/%s", owner, repo, file) - _, _, err = client.Repositories.CreateFile(ctx, owner, repo, file, opts) + create, _, err := client.Repositories.CreateFile(ctx, owner, repo, file, opts) if err != nil { return err } + d.Set("commit_sha", create.GetSHA()) + return resourceGithubRepositoryFileRead(d, meta) } diff --git a/github/resource_github_repository_file_test.go b/github/resource_github_repository_file_test.go index 3515d45f55..83b45e7b4b 100644 --- a/github/resource_github_repository_file_test.go +++ b/github/resource_github_repository_file_test.go @@ -43,6 +43,18 @@ func TestAccGithubRepositoryFile(t *testing.T) { "github_repository_file.test", "sha", "ba0e162e1c47469e3fe4b393a8bf8c569f302116", ), + resource.TestCheckResourceAttrSet( + "github_repository_file.test", "commit_author", + ), + resource.TestCheckResourceAttrSet( + "github_repository_file.test", "commit_email", + ), + resource.TestCheckResourceAttrSet( + "github_repository_file.test", "commit_message", + ), + resource.TestCheckResourceAttrSet( + "github_repository_file.test", "commit_sha", + ), ) testCase := func(t *testing.T, mode string) { @@ -99,6 +111,18 @@ func TestAccGithubRepositoryFile(t *testing.T) { "github_repository_file.test", "sha", "67c1a95c2d9bb138aefeaebb319cca82e531736b", ), + resource.TestCheckResourceAttrSet( + "github_repository_file.test", "commit_author", + ), + resource.TestCheckResourceAttrSet( + "github_repository_file.test", "commit_email", + ), + resource.TestCheckResourceAttrSet( + "github_repository_file.test", "commit_message", + ), + resource.TestCheckResourceAttrSet( + "github_repository_file.test", "commit_sha", + ), ) testCase := func(t *testing.T, mode string) { diff --git a/website/docs/r/repository_file.html.markdown b/website/docs/r/repository_file.html.markdown index 0e0a6f58e9..03e7e97de9 100644 --- a/website/docs/r/repository_file.html.markdown +++ b/website/docs/r/repository_file.html.markdown @@ -44,7 +44,7 @@ The following arguments are supported: * `content` - (Required) The file content. -* `branch` - (Optional) Git branch (defaults to `master`). +* `branch` - (Optional) Git branch (defaults to `main`). The branch must already exist, it will not be created if it does not already exist. * `commit_author` - (Optional) Committer author name to use. @@ -59,6 +59,8 @@ The following arguments are supported: The following additional attributes are exported: +* `commit_sha` - The SHA of the commit that modified the file. + * `sha` - The SHA blob of the file. @@ -70,7 +72,7 @@ Repository files can be imported using a combination of the `repo` and `file`, e $ terraform import github_repository_file.gitignore example/.gitignore ``` -To import a file from a branch other than master, append `:` and the branch name, e.g. +To import a file from a branch other than main, append `:` and the branch name, e.g. ``` $ terraform import github_repository_file.gitignore example/.gitignore:dev From a1809f3a2c470d58e2bbc6d63fa3c4b5cec7f8d2 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Thu, 7 Jan 2021 14:34:53 -0500 Subject: [PATCH 16/45] add release automation for terraform registry /cc https://www.terraform.io/docs/registry/providers/publishing.html --- .github/workflows/release.yml | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..9776db75f7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +# This GitHub action can publish assets for release when a tag is created. +# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). +# +# This uses an action (paultyng/ghaction-import-gpg) that assumes you set your +# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE` +# secret. If you would rather own your own GPG handling, please fork this action +# or use an alternative one for key handling. +# +# You will need to pass the `--batch` flag to `gpg` in your signing step +# in `goreleaser` to indicate this is being used in a non-interactive mode. +# +name: release +on: + push: + tags: + - 'v*' +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Unshallow + run: git fetch --prune --unshallow + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.14 + - + name: Import GPG key + id: import_gpg + uses: paultyng/ghaction-import-gpg@v2.1.0 + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + PASSPHRASE: ${{ secrets.PASSPHRASE }} + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7745b65aee8ced99248e68f3ec08760ed9fe196d Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Thu, 7 Jan 2021 14:39:55 -0500 Subject: [PATCH 17/45] Add v4.2.0 Release (#641) * add v4.1.1 release items * correct semver version * Document Additional Breaking Change For v3.0.0 * add `github_repository_file` bugfix * move to correct release --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f46a5b79c..2dac789b98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## 4.2.0 (Unreleased) + +ENHANCEMENTS: + +- Add `allowDeletions` and `allowsForcePushes` to `github_branch_protection` ([#623](https://github.com/terraform-providers/terraform-provider-github/pull/623)) +- Add GitHub App actor support to `github_branch_protection` ([#615](https://github.com/terraform-providers/terraform-provider-github/pull/615)) + +BUG FIXES: + +- Allow `required_status_checks` `strict` to be `false` for `github_branch_protection` ([#614](https://github.com/terraform-providers/terraform-provider-github/pull/614)) +- Remove `ForceNew` on template-related options for `github_repository` ([#609](https://github.com/terraform-providers/terraform-provider-github/pull/609)) +- Fix parsing of input during imports of `github_branch_protection` ([#610](https://github.com/terraform-providers/terraform-provider-github/pull/610)) +- `github_repository_file` resource no longer iterates through all commits ([#644](https://github.com/terraform-providers/terraform-provider-github/pull/644)) + ## 4.1.0 (December 01, 2020) ENHANCEMENTS: @@ -74,6 +88,7 @@ BREAKING CHANGES: - `organization` no longer deprecated - `individual` and `anonymous` removed - `owner` inferred from `organization` +- `base_url` provider parameter no longer requires `/api/v3` suffix BUG FIXES: From cc9acc77caee51d0c26f7902bb38d6e2183b2b0d Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Thu, 7 Jan 2021 16:00:30 -0500 Subject: [PATCH 18/45] add goreleaser configuration to enable release automation --- .goreleaser.yml | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .goreleaser.yml diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000000..77d63556d8 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,54 @@ +# Visit https://goreleaser.com for documentation on how to customize this +# behavior. +before: + hooks: + # this is just an example and not a requirement for provider building/publishing + - go mod tidy +builds: +- env: + # goreleaser does not work with CGO, it could also complicate + # usage by users in CI/CD systems like Terraform Cloud where + # they are unable to install libraries. + - CGO_ENABLED=0 + mod_timestamp: '{{ .CommitTimestamp }}' + flags: + - -trimpath + ldflags: + - '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' + goos: + - freebsd + - windows + - linux + - darwin + goarch: + - amd64 + - '386' + - arm + - arm64 + ignore: + - goos: darwin + goarch: '386' + binary: '{{ .ProjectName }}_v{{ .Version }}' +archives: +- format: zip + name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' + algorithm: sha256 +signs: + - artifacts: checksum + args: + # if you are using this in a GitHub action or some other automated pipeline, you + # need to pass the batch flag to indicate its not interactive. + - "--batch" + - "--local-user" + - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key + - "--output" + - "${signature}" + - "--detach-sign" + - "${artifact}" +release: + # If you want to manually examine the release before its live, uncomment this line: + # draft: true +changelog: + skip: true From 39ef30e600b310f77b40d1ed2b4437c1187697b5 Mon Sep 17 00:00:00 2001 From: angie pinilla Date: Thu, 14 Jan 2021 10:29:18 -0500 Subject: [PATCH 19/45] resource/repository: add support for enabling github pages (#490) * add support for enabling github pages * update resource comments * add additional comments in expand methods * add formatting fixes Co-authored-by: Jeremy Udit --- github/data_source_github_repository.go | 54 +++++++ github/data_source_github_repository_test.go | 67 +++++++-- github/resource_github_repository.go | 148 ++++++++++++++++++- github/resource_github_repository_test.go | 52 +++++++ website/docs/d/repository.html.markdown | 2 + website/docs/r/repository.html.markdown | 41 +++++ 6 files changed, 354 insertions(+), 10 deletions(-) diff --git a/github/data_source_github_repository.go b/github/data_source_github_repository.go index 2896595dcb..6e20bfee3e 100644 --- a/github/data_source_github_repository.go +++ b/github/data_source_github_repository.go @@ -77,6 +77,50 @@ func dataSourceGithubRepository() *schema.Resource { Type: schema.TypeBool, Computed: true, }, + "pages": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "source": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "branch": { + Type: schema.TypeString, + Computed: true, + }, + "path": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "cname": { + Type: schema.TypeString, + Computed: true, + }, + "custom_404": { + Type: schema.TypeBool, + Computed: true, + }, + "html_url": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "url": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "topics": { Type: schema.TypeList, Elem: &schema.Schema{Type: schema.TypeString}, @@ -164,6 +208,16 @@ func dataSourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) er d.Set("node_id", repo.GetNodeID()) d.Set("repo_id", repo.GetID()) + if repo.GetHasPages() { + pages, _, err := client.Repositories.GetPagesInfo(context.TODO(), owner, repoName) + if err != nil { + return err + } + if err := d.Set("pages", flattenPages(pages)); err != nil { + return fmt.Errorf("error setting pages: %w", err) + } + } + err = d.Set("topics", flattenStringList(repo.Topics)) if err != nil { return err diff --git a/github/data_source_github_repository_test.go b/github/data_source_github_repository_test.go index 1a0cba49fd..4063e85886 100644 --- a/github/data_source_github_repository_test.go +++ b/github/data_source_github_repository_test.go @@ -5,12 +5,13 @@ import ( "regexp" "testing" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccGithubRepositoryDataSource(t *testing.T) { - t.Run("queries a repository without error", func(t *testing.T) { + t.Run("anonymously queries a repository without error", func(t *testing.T) { config := fmt.Sprintf(` data "github_repositories" "test" { @@ -48,14 +49,6 @@ func TestAccGithubRepositoryDataSource(t *testing.T) { testCase(t, anonymous) }) - t.Run("with an individual account", func(t *testing.T) { - testCase(t, individual) - }) - - t.Run("with an organization account", func(t *testing.T) { - testCase(t, organization) - }) - }) t.Run("raises expected errors when querying for a repository", func(t *testing.T) { @@ -102,4 +95,60 @@ func TestAccGithubRepositoryDataSource(t *testing.T) { testCase(t, organization) }) }) + + t.Run("queries a repository with pages configured", func(t *testing.T) { + + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + config := fmt.Sprintf(` + + resource "github_repository" "test" { + name = "tf-acc-%s" + auto_init = true + pages { + source { + branch = "main" + } + } + } + + data "github_repository" "test" { + name = github_repository.test.name + } + `, randomID) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "data.github_repository.test", "pages.0.source.0.branch", + "main", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + testCase(t, individual) + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + }) + } diff --git a/github/resource_github_repository.go b/github/resource_github_repository.go index 115cd4029e..42d851943d 100644 --- a/github/resource_github_repository.go +++ b/github/resource_github_repository.go @@ -121,6 +121,53 @@ func resourceGithubRepository() *schema.Resource { Type: schema.TypeBool, Optional: true, }, + "pages": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "source": { + Type: schema.TypeList, + MaxItems: 1, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "branch": { + Type: schema.TypeString, + Required: true, + }, + "path": { + Type: schema.TypeString, + Optional: true, + Default: "/", + }, + }, + }, + }, + "cname": { + Type: schema.TypeString, + Optional: true, + }, + "custom_404": { + Type: schema.TypeBool, + Computed: true, + }, + "html_url": { + Type: schema.TypeString, + Computed: true, + }, + "status": { + Type: schema.TypeString, + Computed: true, + }, + "url": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "topics": { Type: schema.TypeSet, Optional: true, @@ -133,7 +180,6 @@ func resourceGithubRepository() *schema.Resource { Type: schema.TypeBool, Optional: true, }, - "full_name": { Type: schema.TypeString, Computed: true, @@ -308,6 +354,14 @@ func resourceGithubRepositoryCreate(d *schema.ResourceData, meta interface{}) er } } + pages := expandPages(d.Get("pages").([]interface{})) + if pages != nil { + _, _, err := client.Repositories.EnablePages(ctx, owner, repoName, pages) + if err != nil { + return err + } + } + return resourceGithubRepositoryUpdate(d, meta) } @@ -366,6 +420,16 @@ func resourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) erro d.Set("node_id", repo.GetNodeID()) d.Set("repo_id", repo.GetID()) + if repo.GetHasPages() { + pages, _, err := client.Repositories.GetPagesInfo(ctx, owner, repoName) + if err != nil { + return err + } + if err := d.Set("pages", flattenPages(pages)); err != nil { + return fmt.Errorf("error setting pages: %w", err) + } + } + if repo.TemplateRepository != nil { d.Set("template", []interface{}{ map[string]interface{}{ @@ -423,6 +487,21 @@ func resourceGithubRepositoryUpdate(d *schema.ResourceData, meta interface{}) er } d.SetId(*repo.Name) + if d.HasChange("pages") && !d.IsNewResource() { + opts := expandPagesUpdate(d.Get("pages").([]interface{})) + if opts != nil { + _, err := client.Repositories.UpdatePages(ctx, owner, repoName, opts) + if err != nil { + return err + } + } else { + _, err := client.Repositories.DisablePages(ctx, owner, repoName) + if err != nil { + return err + } + } + } + if d.HasChange("topics") { topics := repoReq.Topics _, _, err = client.Repositories.ReplaceAllTopics(ctx, owner, *repo.Name, topics) @@ -479,3 +558,70 @@ func resourceGithubRepositoryDelete(d *schema.ResourceData, meta interface{}) er _, err := client.Repositories.Delete(ctx, owner, repoName) return err } + +func expandPages(input []interface{}) *github.Pages { + if len(input) == 0 || input[0] == nil { + return nil + } + pages := input[0].(map[string]interface{}) + pagesSource := pages["source"].([]interface{})[0].(map[string]interface{}) + source := &github.PagesSource{ + Branch: github.String(pagesSource["branch"].(string)), + } + if v, ok := pagesSource["path"].(string); ok { + // To set to the root directory "/", leave source.Path unset + if v != "" && v != "/" { + source.Path = github.String(v) + } + } + return &github.Pages{Source: source} +} + +func expandPagesUpdate(input []interface{}) *github.PagesUpdate { + if len(input) == 0 || input[0] == nil { + return nil + } + + pages := input[0].(map[string]interface{}) + update := &github.PagesUpdate{} + + // Only set the github.PagesUpdate CNAME field if the value is a non-empty string. + // Leaving the CNAME field unset will remove the custom domain. + if v, ok := pages["cname"].(string); ok && v != "" { + update.CNAME = github.String(v) + } + + // To update the Github Pages source, the github.PagesUpdate Source field + // must include the branch name and optionally the subdirectory /docs. + // e.g. "master" or "master /docs" + pagesSource := pages["source"].([]interface{})[0].(map[string]interface{}) + source := pagesSource["branch"].(string) + if v, ok := pagesSource["path"].(string); ok { + if v != "" && v != "/" { + source += fmt.Sprintf(" %s", v) + } + } + update.Source = github.String(source) + + return update +} + +func flattenPages(pages *github.Pages) []interface{} { + if pages == nil { + return []interface{}{} + } + + sourceMap := make(map[string]interface{}) + sourceMap["branch"] = pages.GetSource().GetBranch() + sourceMap["path"] = pages.GetSource().GetPath() + + pagesMap := make(map[string]interface{}) + pagesMap["source"] = []interface{}{sourceMap} + pagesMap["url"] = pages.GetURL() + pagesMap["status"] = pages.GetStatus() + pagesMap["cname"] = pages.GetCNAME() + pagesMap["custom_404"] = pages.GetCustom404() + pagesMap["html_url"] = pages.GetHTMLURL() + + return []interface{}{pagesMap} +} diff --git a/github/resource_github_repository_test.go b/github/resource_github_repository_test.go index b7a32a3f1e..1793a9c6f6 100644 --- a/github/resource_github_repository_test.go +++ b/github/resource_github_repository_test.go @@ -614,6 +614,58 @@ func TestAccGithubRepositories(t *testing.T) { }) }) +} +func TestAccGithubRepositoryPages(t *testing.T) { + + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + t.Run("manages the pages feature for a repository", func(t *testing.T) { + + config := fmt.Sprintf(` + resource "github_repository" "test" { + name = "tf-acc-%s" + auto_init = true + pages { + source { + branch = "main" + } + } + } + `, randomID) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "github_repository.test", "pages.0.source.0.branch", + "main", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + testCase(t, individual) + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + }) } diff --git a/website/docs/d/repository.html.markdown b/website/docs/d/repository.html.markdown index 7dbc5efb69..0a43f02d65 100644 --- a/website/docs/d/repository.html.markdown +++ b/website/docs/d/repository.html.markdown @@ -55,6 +55,8 @@ The following arguments are supported: * `archived` - Whether the repository is archived. +* `pages` - The repository's GitHub Pages configuration. + * `topics` - The list of topics of the repository. * `html_url` - URL to the repository on the web. diff --git a/website/docs/r/repository.html.markdown b/website/docs/r/repository.html.markdown index de1f26629b..afcc841e47 100644 --- a/website/docs/r/repository.html.markdown +++ b/website/docs/r/repository.html.markdown @@ -26,6 +26,24 @@ resource "github_repository" "example" { } ``` +## Example Usage with Github Pages Enabled + +```hcl +resource "github_repository" "example" { + name = "example" + description = "My awesome web page" + + private = false + + pages { + source { + branch = "master" + path = "/docs" + } + } +} +``` + ## Argument Reference The following arguments are supported: @@ -75,12 +93,30 @@ initial repository creation and create the target branch inside of the repositor * `archive_on_destroy` - (Optional) Set to `true` to archive the repository instead of deleting on destroy. +* `pages` - (Optional) The repository's Github Pages configuration. See [Github Pages Configuration](#github-pages-configuration) below for details. + * `topics` - (Optional) The list of topics of the repository. * `template` - (Optional) Use a template repository to create this resource. See [Template Repositories](#template-repositories) below for details. * `vulnerability_alerts` (Optional) - 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 public repos but disables them on private repos by default.) See [GitHub Documentation](https://help.github.com/en/github/managing-security-vulnerabilities/about-security-alerts-for-vulnerable-dependencies) for details. +### Github Pages Configuration + +The `pages` block supports the following: + +* `source` - (Required) The source branch and directory for the rendered Pages site. See [Github Pages Source](#github-pages-source) below for details. + +* `cname` - (Optional) The custom domain for the repository. This can only be set after the repository has been created. + +#### Github Pages Source #### + +The `source` block supports the following: + +* `branch` - (Required) The repository branch used to publish the site's source files. (i.e. `main` or `gh-pages`. + +* `path` - (Optional) The repository directory from which the site publishes (Default: `/`). + ### Template Repositories `template` supports the following arguments: @@ -110,6 +146,11 @@ The following additional attributes are exported: * `repo_id` - Github ID for the repository +* `pages` - The block consisting of the repository's Github Pages configuration with the following additional attributes: + * `custom_404` - Whether the rendered Github Pages site has a custom 404 page. + * `html_url` - The absolute URL (including scheme) of the rendered Github Pages site e.g. `https://username.github.io`. + * `status` - The Github Pages site's build status e.g. `building` or `built`. + ## Import Repositories can be imported using the `name`, e.g. From 405dc41822596572a752f704dd62b6fb49508948 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Thu, 14 Jan 2021 10:30:04 -0500 Subject: [PATCH 20/45] Add `github_branch_protection_v3` Resource (#642) * Add `branch_protection_v3` Resource - add new resource to `website/github.erb` - add new resource to `website/docs/r/.html.markdown` - add new resource to `github/provider.go` - add tests for resource in `github/resource__test.go` - implement new resource in `github/resource_.go` * fixup! gofmt fixes --- github/provider.go | 1 + .../resource_github_branch_protection_v3.go | 335 ++++++++++++++++++ ...source_github_branch_protection_v3_test.go | 273 ++++++++++++++ ...ource_github_branch_protection_v3_utils.go | 304 ++++++++++++++++ go.mod | 1 - .../docs/r/branch_protection_v3.html.markdown | 115 ++++++ website/github.erb | 3 + 7 files changed, 1031 insertions(+), 1 deletion(-) create mode 100644 github/resource_github_branch_protection_v3.go create mode 100644 github/resource_github_branch_protection_v3_test.go create mode 100644 github/resource_github_branch_protection_v3_utils.go create mode 100644 website/docs/r/branch_protection_v3.html.markdown diff --git a/github/provider.go b/github/provider.go index c1aa42cc99..4992379bb5 100644 --- a/github/provider.go +++ b/github/provider.go @@ -45,6 +45,7 @@ func Provider() terraform.ResourceProvider { "github_actions_secret": resourceGithubActionsSecret(), "github_branch": resourceGithubBranch(), "github_branch_protection": resourceGithubBranchProtection(), + "github_branch_protection_v3": resourceGithubBranchProtectionV3(), "github_issue_label": resourceGithubIssueLabel(), "github_membership": resourceGithubMembership(), "github_organization_block": resourceOrganizationBlock(), diff --git a/github/resource_github_branch_protection_v3.go b/github/resource_github_branch_protection_v3.go new file mode 100644 index 0000000000..ff57a41361 --- /dev/null +++ b/github/resource_github_branch_protection_v3.go @@ -0,0 +1,335 @@ +package github + +import ( + "context" + "fmt" + "log" + "net/http" + + "github.com/google/go-github/v32/github" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" +) + +func resourceGithubBranchProtectionV3() *schema.Resource { + return &schema.Resource{ + Create: resourceGithubBranchProtectionV3Create, + Read: resourceGithubBranchProtectionV3Read, + Update: resourceGithubBranchProtectionV3Update, + Delete: resourceGithubBranchProtectionV3Delete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "repository": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "branch": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "required_status_checks": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "include_admins": { + Type: schema.TypeBool, + Optional: true, + Default: false, + Deprecated: "Use enforce_admins instead", + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return true + }, + }, + "strict": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "contexts": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + "required_pull_request_reviews": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &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", + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return true + }, + }, + "dismiss_stale_reviews": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "dismissal_users": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "dismissal_teams": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "require_code_owner_reviews": { + Type: schema.TypeBool, + Optional: true, + }, + "required_approving_review_count": { + Type: schema.TypeInt, + Optional: true, + Default: 1, + ValidateFunc: validation.IntBetween(1, 6), + }, + }, + }, + }, + "restrictions": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "users": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "teams": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + "apps": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + }, + }, + "enforce_admins": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "require_signed_commits": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, + "etag": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceGithubBranchProtectionV3Create(d *schema.ResourceData, meta interface{}) error { + err := checkOrganization(meta) + if err != nil { + return err + } + + client := meta.(*Owner).v3client + + orgName := meta.(*Owner).name + repoName := d.Get("repository").(string) + branch := d.Get("branch").(string) + + protectionRequest, err := buildProtectionRequest(d) + if err != nil { + return err + } + ctx := context.Background() + + log.Printf("[DEBUG] Creating branch protection: %s/%s (%s)", + orgName, repoName, branch) + protection, _, err := client.Repositories.UpdateBranchProtection(ctx, + orgName, + repoName, + branch, + protectionRequest, + ) + if err != nil { + return err + } + + if err := checkBranchRestrictionsUsers(protection.GetRestrictions(), protectionRequest.GetRestrictions()); err != nil { + return err + } + + d.SetId(buildTwoPartID(repoName, branch)) + + if err = requireSignedCommitsUpdate(d, meta); err != nil { + return err + } + + return resourceGithubBranchProtectionV3Read(d, meta) +} + +func resourceGithubBranchProtectionV3Read(d *schema.ResourceData, meta interface{}) error { + err := checkOrganization(meta) + if err != nil { + return err + } + + client := meta.(*Owner).v3client + + repoName, branch, err := parseTwoPartID(d.Id(), "repository", "branch") + if err != nil { + return err + } + orgName := meta.(*Owner).name + + ctx := context.WithValue(context.Background(), ctxId, d.Id()) + if !d.IsNewResource() { + ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) + } + + log.Printf("[DEBUG] Reading branch protection: %s/%s (%s)", + orgName, repoName, branch) + githubProtection, resp, err := client.Repositories.GetBranchProtection(ctx, + orgName, repoName, branch) + if err != nil { + if ghErr, ok := err.(*github.ErrorResponse); ok { + if ghErr.Response.StatusCode == http.StatusNotModified { + if err := requireSignedCommitsRead(d, meta); err != nil { + return fmt.Errorf("Error setting signed commit restriction: %v", err) + } + return nil + } + if ghErr.Response.StatusCode == http.StatusNotFound { + log.Printf("[WARN] Removing branch protection %s/%s (%s) from state because it no longer exists in GitHub", + orgName, repoName, branch) + d.SetId("") + return nil + } + } + + return err + } + + d.Set("etag", resp.Header.Get("ETag")) + d.Set("repository", repoName) + d.Set("branch", branch) + d.Set("enforce_admins", githubProtection.GetEnforceAdmins().Enabled) + + if err := flattenAndSetRequiredStatusChecks(d, githubProtection); err != nil { + return fmt.Errorf("Error setting required_status_checks: %v", err) + } + + if err := flattenAndSetRequiredPullRequestReviews(d, githubProtection); err != nil { + return fmt.Errorf("Error setting required_pull_request_reviews: %v", err) + } + + if err := flattenAndSetRestrictions(d, githubProtection); err != nil { + return fmt.Errorf("Error setting restrictions: %v", err) + } + + if err := requireSignedCommitsRead(d, meta); err != nil { + return fmt.Errorf("Error setting signed commit restriction: %v", err) + } + + return nil +} + +func resourceGithubBranchProtectionV3Update(d *schema.ResourceData, meta interface{}) error { + err := checkOrganization(meta) + if err != nil { + return err + } + + client := meta.(*Owner).v3client + repoName, branch, err := parseTwoPartID(d.Id(), "repository", "branch") + if err != nil { + return err + } + + protectionRequest, err := buildProtectionRequest(d) + if err != nil { + return err + } + + orgName := meta.(*Owner).name + ctx := context.WithValue(context.Background(), ctxId, d.Id()) + + log.Printf("[DEBUG] Updating branch protection: %s/%s (%s)", + orgName, repoName, branch) + protection, _, err := client.Repositories.UpdateBranchProtection(ctx, + orgName, + repoName, + branch, + protectionRequest, + ) + if err != nil { + return err + } + + if err := checkBranchRestrictionsUsers(protection.GetRestrictions(), protectionRequest.GetRestrictions()); err != nil { + return err + } + + if protectionRequest.RequiredPullRequestReviews == nil { + _, err = client.Repositories.RemovePullRequestReviewEnforcement(ctx, + orgName, + repoName, + branch, + ) + if err != nil { + return err + } + } + + d.SetId(buildTwoPartID(repoName, branch)) + + if err = requireSignedCommitsUpdate(d, meta); err != nil { + return err + } + + return resourceGithubBranchProtectionV3Read(d, meta) +} + +func resourceGithubBranchProtectionV3Delete(d *schema.ResourceData, meta interface{}) error { + err := checkOrganization(meta) + if err != nil { + return err + } + + client := meta.(*Owner).v3client + repoName, branch, err := parseTwoPartID(d.Id(), "repository", "branch") + if err != nil { + return err + } + + orgName := meta.(*Owner).name + ctx := context.WithValue(context.Background(), ctxId, d.Id()) + + log.Printf("[DEBUG] Deleting branch protection: %s/%s (%s)", orgName, repoName, branch) + _, err = client.Repositories.RemoveBranchProtection(ctx, + orgName, repoName, branch) + return err +} diff --git a/github/resource_github_branch_protection_v3_test.go b/github/resource_github_branch_protection_v3_test.go new file mode 100644 index 0000000000..2947430713 --- /dev/null +++ b/github/resource_github_branch_protection_v3_test.go @@ -0,0 +1,273 @@ +package github + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccGithubBranchProtectionV3_defaults(t *testing.T) { + + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + t.Run("configures default settings when empty", func(t *testing.T) { + + config := fmt.Sprintf(` + + resource "github_repository" "test" { + name = "tf-acc-test-%s" + auto_init = true + } + + resource "github_branch_protection_v3" "test" { + + repository = github_repository.test.name + branch = "main" + + } + + `, randomID) + + check := resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "branch", "main", + ), + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "require_signed_commits", "false", + ), + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "required_status_checks.#", "0", + ), + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "required_pull_request_reviews.#", "0", + ), + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "push_restrictions.#", "0", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + }) +} +func TestAccGithubBranchProtectionV3_required_status_checks(t *testing.T) { + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + t.Run("configures required status checks", func(t *testing.T) { + + config := fmt.Sprintf(` + + resource "github_repository" "test" { + name = "tf-acc-test-%s" + auto_init = true + } + + resource "github_branch_protection_v3" "test" { + + repository = github_repository.test.name + branch = "main" + + required_status_checks { + strict = true + contexts = ["github/foo"] + } + + } + + `, randomID) + + check := resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "required_status_checks.#", "1", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + }) +} +func TestAccGithubBranchProtectionV3_required_pull_request_reviews(t *testing.T) { + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + t.Run("configures required pull request reviews", func(t *testing.T) { + + config := fmt.Sprintf(` + + resource "github_repository" "test" { + name = "tf-acc-test-%s" + auto_init = true + } + + resource "github_branch_protection_v3" "test" { + + repository = github_repository.test.name + branch = "main" + + required_pull_request_reviews { + dismiss_stale_reviews = true + require_code_owner_reviews = true + } + + } + + `, randomID) + + check := resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "required_pull_request_reviews.#", "1", + ), + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "required_pull_request_reviews.0.dismiss_stale_reviews", "true", + ), + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "required_pull_request_reviews.0.require_code_owner_reviews", "true", + ), + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "required_pull_request_reviews.0.required_approving_review_count", "1", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + }) +} + +func TestAccGithubBranchProtectionV3_branch_push_restrictions(t *testing.T) { + + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + t.Run("configures branch push restrictions", func(t *testing.T) { + + config := fmt.Sprintf(` + resource "github_repository" "test" { + name = "tf-acc-test-%s" + auto_init = true + } + + resource "github_team" "test" { + name = "tf-acc-test-%[1]s" + } + + resource "github_team_repository" "test" { + team_id = "${github_team.test.id}" + repository = "${github_repository.test.name}" + permission = "pull" + } + + resource "github_branch_protection_v3" "test" { + + repository = github_repository.test.name + branch = "main" + + restrictions { + teams = ["${github_team.test.slug}"] + } + + } + `, randomID) + + check := resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "github_branch_protection_v3.test", "restrictions.#", "1", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + }) + +} diff --git a/github/resource_github_branch_protection_v3_utils.go b/github/resource_github_branch_protection_v3_utils.go new file mode 100644 index 0000000000..c369a92b6e --- /dev/null +++ b/github/resource_github_branch_protection_v3_utils.go @@ -0,0 +1,304 @@ +package github + +import ( + "context" + "errors" + "fmt" + "log" + "strings" + + "github.com/google/go-github/v32/github" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func buildProtectionRequest(d *schema.ResourceData) (*github.ProtectionRequest, error) { + req := &github.ProtectionRequest{ + EnforceAdmins: d.Get("enforce_admins").(bool), + } + + rsc, err := expandRequiredStatusChecks(d) + if err != nil { + return nil, err + } + req.RequiredStatusChecks = rsc + + rprr, err := expandRequiredPullRequestReviews(d) + if err != nil { + return nil, err + } + req.RequiredPullRequestReviews = rprr + + res, err := expandRestrictions(d) + if err != nil { + return nil, err + } + req.Restrictions = res + + return req, nil +} + +func flattenAndSetRequiredStatusChecks(d *schema.ResourceData, protection *github.Protection) error { + rsc := protection.GetRequiredStatusChecks() + if rsc != nil { + contexts := make([]interface{}, 0, len(rsc.Contexts)) + for _, c := range rsc.Contexts { + contexts = append(contexts, c) + } + + return d.Set("required_status_checks", []interface{}{ + map[string]interface{}{ + "strict": rsc.Strict, + "contexts": schema.NewSet(schema.HashString, contexts), + }, + }) + } + + return d.Set("required_status_checks", []interface{}{}) +} + +func requireSignedCommitsRead(d *schema.ResourceData, meta interface{}) error { + client := meta.(*Owner).v3client + + repoName, branch, err := parseTwoPartID(d.Id(), "repository", "branch") + if err != nil { + return err + } + orgName := meta.(*Owner).name + + ctx := context.WithValue(context.Background(), ctxId, d.Id()) + if !d.IsNewResource() { + ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) + } + + log.Printf("[DEBUG] Reading branch protection signed commit status: %s/%s (%s)", orgName, repoName, branch) + signedCommitStatus, _, err := client.Repositories.GetSignaturesProtectedBranch(ctx, + orgName, repoName, branch) + if err != nil { + log.Printf("[WARN] Not able to read signature protection: %s/%s (%s)", orgName, repoName, branch) + return nil + } + + return d.Set("require_signed_commits", signedCommitStatus.Enabled) +} + +func requireSignedCommitsUpdate(d *schema.ResourceData, meta interface{}) (err error) { + requiredSignedCommit := d.Get("require_signed_commits").(bool) + client := meta.(*Owner).v3client + + repoName, branch, err := parseTwoPartID(d.Id(), "repository", "branch") + if err != nil { + return err + } + orgName := meta.(*Owner).name + + ctx := context.WithValue(context.Background(), ctxId, d.Id()) + if !d.IsNewResource() { + ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string)) + } + + if requiredSignedCommit { + log.Printf("[DEBUG] Enabling branch protection signed commit: %s/%s (%s) - $s", orgName, repoName, branch) + _, _, err = client.Repositories.RequireSignaturesOnProtectedBranch(ctx, orgName, repoName, branch) + } else { + log.Printf("[DEBUG] Removing branch protection signed commit: %s/%s (%s) - $s", orgName, repoName, branch) + _, err = client.Repositories.OptionalSignaturesOnProtectedBranch(ctx, orgName, repoName, branch) + } + return err +} + +func flattenAndSetRequiredPullRequestReviews(d *schema.ResourceData, protection *github.Protection) error { + rprr := protection.GetRequiredPullRequestReviews() + if rprr != nil { + var users, teams []interface{} + restrictions := rprr.GetDismissalRestrictions() + + if restrictions != nil { + users = make([]interface{}, 0, len(restrictions.Users)) + for _, u := range restrictions.Users { + if u.Login != nil { + users = append(users, *u.Login) + } + } + teams = make([]interface{}, 0, len(restrictions.Teams)) + for _, t := range restrictions.Teams { + if t.Slug != nil { + teams = append(teams, *t.Slug) + } + } + } + + return d.Set("required_pull_request_reviews", []interface{}{ + map[string]interface{}{ + "dismiss_stale_reviews": rprr.DismissStaleReviews, + "dismissal_users": schema.NewSet(schema.HashString, users), + "dismissal_teams": schema.NewSet(schema.HashString, teams), + "require_code_owner_reviews": rprr.RequireCodeOwnerReviews, + "required_approving_review_count": rprr.RequiredApprovingReviewCount, + }, + }) + } + + return d.Set("required_pull_request_reviews", []interface{}{}) +} + +func flattenAndSetRestrictions(d *schema.ResourceData, protection *github.Protection) error { + restrictions := protection.GetRestrictions() + if restrictions != nil { + users := make([]interface{}, 0, len(restrictions.Users)) + for _, u := range restrictions.Users { + if u.Login != nil { + users = append(users, *u.Login) + } + } + + teams := make([]interface{}, 0, len(restrictions.Teams)) + for _, t := range restrictions.Teams { + if t.Slug != nil { + teams = append(teams, *t.Slug) + } + } + + apps := make([]interface{}, 0, len(restrictions.Apps)) + for _, t := range restrictions.Apps { + if t.Slug != nil { + apps = append(apps, *t.Slug) + } + } + + return d.Set("restrictions", []interface{}{ + map[string]interface{}{ + "users": schema.NewSet(schema.HashString, users), + "teams": schema.NewSet(schema.HashString, teams), + "apps": schema.NewSet(schema.HashString, apps), + }, + }) + } + + return d.Set("restrictions", []interface{}{}) +} + +func expandRequiredStatusChecks(d *schema.ResourceData) (*github.RequiredStatusChecks, error) { + if v, ok := d.GetOk("required_status_checks"); ok { + vL := v.([]interface{}) + if len(vL) > 1 { + return nil, errors.New("cannot specify required_status_checks more than one time") + } + rsc := new(github.RequiredStatusChecks) + + for _, v := range vL { + // List can only have one item, safe to early return here + if v == nil { + return nil, nil + } + m := v.(map[string]interface{}) + rsc.Strict = m["strict"].(bool) + + contexts := expandNestedSet(m, "contexts") + rsc.Contexts = contexts + } + return rsc, nil + } + + return nil, nil +} + +func expandRequiredPullRequestReviews(d *schema.ResourceData) (*github.PullRequestReviewsEnforcementRequest, error) { + if v, ok := d.GetOk("required_pull_request_reviews"); ok { + vL := v.([]interface{}) + if len(vL) > 1 { + return nil, errors.New("cannot specify required_pull_request_reviews more than one time") + } + + rprr := new(github.PullRequestReviewsEnforcementRequest) + drr := new(github.DismissalRestrictionsRequest) + + for _, v := range vL { + // List can only have one item, safe to early return here + if v == nil { + return nil, nil + } + m := v.(map[string]interface{}) + + users := expandNestedSet(m, "dismissal_users") + if len(users) > 0 { + drr.Users = &users + } + teams := expandNestedSet(m, "dismissal_teams") + if len(teams) > 0 { + drr.Teams = &teams + } + + rprr.DismissalRestrictionsRequest = drr + rprr.DismissStaleReviews = m["dismiss_stale_reviews"].(bool) + rprr.RequireCodeOwnerReviews = m["require_code_owner_reviews"].(bool) + rprr.RequiredApprovingReviewCount = m["required_approving_review_count"].(int) + } + + return rprr, nil + } + + return nil, nil +} + +func expandRestrictions(d *schema.ResourceData) (*github.BranchRestrictionsRequest, error) { + if v, ok := d.GetOk("restrictions"); ok { + vL := v.([]interface{}) + if len(vL) > 1 { + return nil, errors.New("cannot specify restrictions more than one time") + } + restrictions := new(github.BranchRestrictionsRequest) + + for _, v := range vL { + // Restrictions only have set attributes nested, need to return nil values for these. + // The API won't initialize these as nil + if v == nil { + restrictions.Users = []string{} + restrictions.Teams = []string{} + restrictions.Apps = []string{} + return restrictions, nil + } + m := v.(map[string]interface{}) + + users := expandNestedSet(m, "users") + restrictions.Users = users + teams := expandNestedSet(m, "teams") + restrictions.Teams = teams + apps := expandNestedSet(m, "apps") + restrictions.Apps = apps + } + return restrictions, nil + } + + return nil, nil +} + +func checkBranchRestrictionsUsers(actual *github.BranchRestrictions, expected *github.BranchRestrictionsRequest) error { + if expected == nil { + return nil + } + + expectedUsers := expected.Users + + if actual == nil { + return fmt.Errorf("unable to add users in restrictions: %s", strings.Join(expectedUsers, ", ")) + } + + actualLoopUp := make(map[string]struct{}, len(actual.Users)) + for _, a := range actual.Users { + actualLoopUp[a.GetLogin()] = struct{}{} + } + + notFounds := make([]string, 0, len(actual.Users)) + + for _, e := range expectedUsers { + if _, ok := actualLoopUp[e]; !ok { + notFounds = append(notFounds, e) + } + } + + if len(notFounds) == 0 { + return nil + } + + return fmt.Errorf("unable to add users in restrictions: %s", strings.Join(notFounds, ", ")) +} diff --git a/go.mod b/go.mod index 39d945478e..90ec723d11 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.13 require ( github.com/client9/misspell v0.3.4 github.com/golangci/golangci-lint v1.25.1 - github.com/google/go-github/v31 v31.0.0 // indirect github.com/google/go-github/v32 v32.1.0 github.com/hashicorp/terraform v0.12.24 github.com/hashicorp/terraform-plugin-sdk v1.7.0 diff --git a/website/docs/r/branch_protection_v3.html.markdown b/website/docs/r/branch_protection_v3.html.markdown new file mode 100644 index 0000000000..c98cf15549 --- /dev/null +++ b/website/docs/r/branch_protection_v3.html.markdown @@ -0,0 +1,115 @@ +--- +layout: "github" +page_title: "GitHub: github_branch_protection_v3" +description: |- + Protects a GitHub branch using the v3 / REST implementation. The `github_branch_protection` resource has moved to the GraphQL API, while this resource will continue to leverage the REST API +--- + +# github\_branch\_protection + +Protects a GitHub branch. + +The `github_branch_protection` resource has moved to the GraphQL API, while this resource will continue to leverage the REST API. + +This resource allows you to configure branch protection for repositories in your organization. When applied, the branch will be protected from forced pushes and deletion. Additional constraints, such as required status checks or restrictions on users, teams, and apps, can also be configured. + +## Example Usage + +```hcl +# Protect the main branch of the foo repository. Only allow a specific user to merge to the branch. +resource " github_branch_protection_v3" "example" { + repository = "${github_repository.example.name}" + branch = "main" + restrictions { + users = ["foo-user"] + } +} +``` + +```hcl +# Protect the main branch of the foo repository. Additionally, require that +# the "ci/travis" context to be passing and only allow the engineers team merge +# to the branch. + +resource " github_branch_protection_v3" "example" { + repository = "${github_repository.example.name}" + branch = "main" + enforce_admins = true + + required_status_checks { + strict = false + contexts = ["ci/travis"] + } + + required_pull_request_reviews { + dismiss_stale_reviews = true + dismissal_users = ["foo-user"] + dismissal_teams = ["${github_team.example.slug}", "${github_team.second.slug}"] + } + + restrictions { + users = ["foo-user"] + teams = ["${github_team.example.slug}"] + apps = ["foo-app"] + } +} + +resource "github_team" "example" { + name = "Example Name" +} + +resource "github_team_repository" "example" { + team_id = "${github_team.example.id}" + repository = "${github_repository.example.name}" + permission = "pull" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `repository` - (Required) The GitHub repository name. +* `branch` - (Required) The Git branch to protect. +* `enforce_admins` - (Optional) Boolean, setting this to `true` enforces status checks for repository administrators. +* `require_signed_commits` - (Optional) Boolean, setting this to `true` requires all commits to be signed with GPG. +* `required_status_checks` - (Optional) Enforce restrictions for required status checks. See [Required Status Checks](#required-status-checks) below for details. +* `required_pull_request_reviews` - (Optional) Enforce restrictions for pull request reviews. See [Required Pull Request Reviews](#required-pull-request-reviews) below for details. +* `restrictions` - (Optional) Enforce restrictions for the users and teams that may push to the branch. See [Restrictions](#restrictions) below for details. + +### Required Status Checks + +`required_status_checks` supports the following arguments: + +* `strict`: (Optional) Require branches to be up to date before merging. Defaults to `false`. +* `contexts`: (Optional) The list of status checks to require in order to merge into this branch. No status checks are required by default. + +### Required Pull Request Reviews + +`required_pull_request_reviews` supports the following arguments: + +* `dismiss_stale_reviews`: (Optional) Dismiss approved reviews automatically when a new commit is pushed. Defaults to `false`. +* `dismissal_users`: (Optional) The list of user logins with dismissal access +* `dismissal_teams`: (Optional) The list of team slugs with dismissal access. + Always use `slug` of the team, **not** its name. Each team already **has** to have access to the repository. +* `require_code_owner_reviews`: (Optional) Require an approved review in pull requests including files with a designated code owner. Defaults to `false`. +* `required_approving_review_count`: (Optional) Require x number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 1-6. This requirement matches Github's API, see the upstream [documentation](https://developer.github.com/v3/repos/branches/#parameters-1) for more information. + +### Restrictions + +`restrictions` supports the following arguments: + +* `users`: (Optional) The list of user logins with push access. +* `teams`: (Optional) The list of team slugs with push access. + Always use `slug` of the team, **not** its name. Each team already **has** to have access to the repository. +* `apps`: (Optional) The list of app slugs with push access. + +`restrictions` is only available for organization-owned repositories. + +## Import + +GitHub Branch Protection can be imported using an ID made up of `repository:branch`, e.g. + +``` +$ terraform import github_branch_protection_v3.terraform terraform:main +``` diff --git a/website/github.erb b/website/github.erb index 235fb61191..f46d0088ac 100644 --- a/website/github.erb +++ b/website/github.erb @@ -70,6 +70,9 @@
  • github_branch_protection
  • +
  • + github_branch_protection_v3 +
  • github_issue_label
  • From 872bb967b7a1ef841d3953f9c54b620b0b9edb62 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Sat, 16 Jan 2021 18:18:16 -0500 Subject: [PATCH 21/45] add changelog entries for v4.3.0 release (#658) --- CHANGELOG.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dac789b98..94e2e335c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,17 @@ -## 4.2.0 (Unreleased) +## 4.3.0 (January 14, 2021) + +ENHANCEMENTS: + +* **New Resource** `github_branch_protection_v3` ([#642](https://github.com/terraform-providers/terraform-provider-github/issues/642)) +* Add `pages` feature to `github_repository` ([#490](https://github.com/terraform-providers/terraform-provider-github/issues/490)) + + +## 4.2.0 (January 07, 2021) + +BREAKING CHANGES: + +- Project transfer from `terraform-providers` organization to `integrations` + - See [#652](https://github.com/integrations/terraform-provider-github/issues/652) for migration steps and [#656](https://github.com/integrations/terraform-provider-github/issues/656) for discussion ENHANCEMENTS: From 3494128ab7c44d32e9266a3bd094e9bf16db7c0d Mon Sep 17 00:00:00 2001 From: Shu Kutsuzawa Date: Sun, 17 Jan 2021 08:30:21 +0900 Subject: [PATCH 22/45] Remove github.com/hashicorp/terraform from dependencies (#628) * remove github.com/hashicorp/terraform from dependencies * go mod tidy * refactor: execute fmt --- ...a_source_github_actions_public_key_test.go | 2 +- github/data_source_github_team_test.go | 2 +- go.mod | 5 +- go.sum | 134 ------- vendor/github.com/hashicorp/terraform/LICENSE | 354 ------------------ .../terraform/helper/acctest/acctest.go | 2 - .../terraform/helper/acctest/random.go | 176 --------- .../terraform/helper/acctest/remotetests.go | 27 -- vendor/modules.txt | 2 - 9 files changed, 5 insertions(+), 699 deletions(-) delete mode 100644 vendor/github.com/hashicorp/terraform/LICENSE delete mode 100644 vendor/github.com/hashicorp/terraform/helper/acctest/acctest.go delete mode 100644 vendor/github.com/hashicorp/terraform/helper/acctest/random.go delete mode 100644 vendor/github.com/hashicorp/terraform/helper/acctest/remotetests.go diff --git a/github/data_source_github_actions_public_key_test.go b/github/data_source_github_actions_public_key_test.go index f4788dbb37..0b4ebc9422 100644 --- a/github/data_source_github_actions_public_key_test.go +++ b/github/data_source_github_actions_public_key_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform/helper/acctest" ) func TestAccGithubActionsPublicKeyDataSource(t *testing.T) { diff --git a/github/data_source_github_team_test.go b/github/data_source_github_team_test.go index a3c6857bf6..2a9d6b980a 100644 --- a/github/data_source_github_team_test.go +++ b/github/data_source_github_team_test.go @@ -5,8 +5,8 @@ import ( "regexp" "testing" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform/helper/acctest" ) func TestAccGithubTeamDataSource(t *testing.T) { diff --git a/go.mod b/go.mod index 90ec723d11..715f13081f 100644 --- a/go.mod +++ b/go.mod @@ -6,9 +6,10 @@ require ( github.com/client9/misspell v0.3.4 github.com/golangci/golangci-lint v1.25.1 github.com/google/go-github/v32 v32.1.0 - github.com/hashicorp/terraform v0.12.24 + github.com/hashicorp/go-getter v1.4.2-0.20200106182914-9813cbd4eb02 // indirect + github.com/hashicorp/hcl/v2 v2.3.0 // indirect + github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7 // indirect github.com/hashicorp/terraform-plugin-sdk v1.7.0 - github.com/kylelemons/godebug v1.1.0 // indirect github.com/shurcooL/githubv4 v0.0.0-20201206200315-234843c633fa github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d diff --git a/go.sum b/go.sum index 97533d08f2..88b402f8df 100644 --- a/go.sum +++ b/go.sum @@ -7,46 +7,19 @@ cloud.google.com/go v0.45.1 h1:lRi0CHyU+ytlvylOlFKKq0af6JncuyoRh1J+QJBqQx0= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -github.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v36.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest v0.9.2/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.8.1-0.20191028180845-3492b2aff503/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= -github.com/Azure/go-autorest/autorest/azure/cli v0.2.0/go.mod h1:WWTbGPvkAg3I4ms2j2s+Zr5xCGwGqTQh+6M2ZqOczkE= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= -github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA= -github.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRYq3HT1WyXAvT7LLY3tl70hw6tQIbjI= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= -github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= -github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292/go.mod h1:KYCjqMOeHpNuTOiFQU6WEcTG7poCJrUs0YgyHNtn1no= -github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/agl/ed25519 v0.0.0-20150830182803-278e1ec8e8a6/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190329064014-6e358769c32a/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA= -github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190103054945-8205d1f41e70/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= -github.com/aliyun/aliyun-tablestore-go-sdk v4.1.2+incompatible/go.mod h1:LDQHRZylxvcg8H7wBIDfvO5g/cy4/sz1iucBlc2l3Jw= -github.com/antchfx/xpath v0.0.0-20190129040759-c8489ed3251e/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= -github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= github.com/apparentlymart/go-cidr v1.0.1 h1:NmIwLZ/KdsjIUlhf+/Np40atNXm/+lZ5txfTJ/SpF+U= github.com/apparentlymart/go-cidr v1.0.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= @@ -54,43 +27,29 @@ github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFU github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/apparentlymart/go-versions v0.0.2-0.20180815153302-64b99f7cb171/go.mod h1:JXY95WvQrPJQtudvNARshgWajS7jNNlM90altXIPNyI= -github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.25.3 h1:uM16hIw9BotjZKMZlX05SN2EFtaWfi/NonPKIARiBLQ= github.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= -github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmatcuk/doublestar v1.1.5 h1:2bNwBOmhyFEFcoB3tGvTD5xanq+4kyOZlB8wFYbMjkk= -github.com/bmatcuk/doublestar v1.1.5/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/bombsimon/wsl/v3 v3.0.0 h1:w9f49xQatuaeTJFaNP4SpiWSR5vfT6IstPtM62JjcqA= github.com/bombsimon/wsl/v3 v3.0.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.0/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -101,10 +60,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= -github.com/dnaeon/go-vcr v0.0.0-20180920040454-5637cf3d8a31/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= -github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= -github.com/dylanmei/winrmtest v0.0.0-20190225150635-99b7fe2fddf1/go.mod h1:lcy9/2gH1jn/VCLouHA6tOEwLoNVd4GW6zhuKLmHC2Y= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= @@ -120,7 +75,6 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= @@ -150,12 +104,10 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b h1:ekuhfTjngPhisSjOJ0QWKpPQE8/rbknHaes6WVJj5Hw= github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -166,7 +118,6 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= @@ -204,11 +155,6 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= -github.com/google/go-github/v31 v31.0.0 h1:JJUxlP9lFK+ziXKimTCprajMApV1ecWD4NB6CCb0plo= -github.com/google/go-github/v31 v31.0.0/go.mod h1:NQPZol8/1sMoWYGN2yaALIBytu17gAWfhbweiEed3pM= -github.com/google/go-github/v32 v31.0.0 h1:JJUxlP9lFK+ziXKimTCprajMApV1ecWD4NB6CCb0plo= -github.com/google/go-github/v32 v31.0.0/go.mod h1:NQPZol8/1sMoWYGN2yaALIBytu17gAWfhbweiEed3pM= github.com/google/go-github/v32 v32.1.0 h1:GWkQOdXqviCPx7Q7Fj+KyPoGm4SwHRh8rheoPhd27II= github.com/google/go-github/v32 v32.1.0/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= @@ -224,8 +170,6 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gophercloud/gophercloud v0.0.0-20190208042652-bc37892e1968/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= -github.com/gophercloud/utils v0.0.0-20190128072930-fbb6ab446f01/go.mod h1:wjDF8z83zTeg5eMLml5EBSlAhbF7G8DobyI1YsMuyzw= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= @@ -233,14 +177,9 @@ github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3 h1:J github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/aws-sdk-go-base v0.4.0/go.mod h1:eRhlz3c4nhqxFZJAahJEFL7gh6Jyj5rQmQc7F9eHFyQ= -github.com/hashicorp/consul v0.0.0-20171026175957-610f3c86a089/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-azure-helpers v0.10.0/go.mod h1:YuAtHxm2v74s+IjQwUG88dHBJPd5jL+cXr5BGVzSKhE= -github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -249,25 +188,14 @@ github.com/hashicorp/go-getter v1.4.0/go.mod h1:7qxyCd8rBfcShwsvxgIguu4KbS3l8bUC github.com/hashicorp/go-getter v1.4.2-0.20200106182914-9813cbd4eb02 h1:l1KB3bHVdvegcIf5upQ5mjcHjs2qsWnKh4Yr9xgIuu8= github.com/hashicorp/go-getter v1.4.2-0.20200106182914-9813cbd4eb02/go.mod h1:7qxyCd8rBfcShwsvxgIguu4KbS3l8bUCwg2Umn7RjeY= github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= -github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa/go.mod h1:6ij3Z20p+OhOkCSrA0gImAWoHYQRGbnlcuk6XYTiaRw= -github.com/hashicorp/go-msgpack v0.5.4/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-plugin v1.0.1-0.20190610192547-a1bc61569a26/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-plugin v1.0.1 h1:4OtAfUGbnKC6yS48p0CtMX2oFYtzFZVv6rok3cRWgnE= github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= -github.com/hashicorp/go-retryablehttp v0.5.2 h1:AoISa4P4IsW0/m4T6St8Yw38gTl5GtBAgfkhYh1xAz4= -github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= -github.com/hashicorp/go-slug v0.4.1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8= -github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-tfe v0.3.27/go.mod h1:DVPSW2ogH+M9W1/i50ASgMht8cHP7NxxK0nrY9aFikQ= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -284,14 +212,8 @@ github.com/hashicorp/hcl/v2 v2.0.0 h1:efQznTz+ydmQXq3BOnRa3AXzvCeTq1P4dKj/z5GLlY github.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90= github.com/hashicorp/hcl/v2 v2.3.0 h1:iRly8YaMwTBAKhn1Ybk7VSdzbnopghktCD031P8ggUE= github.com/hashicorp/hcl/v2 v2.3.0/go.mod h1:d+FwDBbOLvpAM3Z6J7gPj/VoAGkNe/gm352ZhjJ/Zv8= -github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590 h1:2yzhWGdgQUWZUCNK+AoO35V+HTsgEmcM4J9IkArh7PI= -github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590/go.mod h1:n2TSygSNwsLJ76m8qFXTSc7beTb+auJxYdqrnoqwZWE= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/memberlist v0.1.0/go.mod h1:ncdBp14cuox2iFOq3kDiquKU6fqsTBc3W6JvZwjxxsE= -github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE= -github.com/hashicorp/terraform v0.12.24 h1:lTTswsCcmTOhTwuUl2NdjtJBCNdGqZmRGQi0cjFHYOM= -github.com/hashicorp/terraform v0.12.24/go.mod h1:eJcloDEx5ywM4a1tetIuVrlqklM0bUVRYJBYAh4CYzA= github.com/hashicorp/terraform-config-inspect v0.0.0-20191115094559-17f92b0546e8 h1:+RyjwU+Gnd/aTJBPZVDNm903eXVjjqhbaR4Ypx3xYyY= github.com/hashicorp/terraform-config-inspect v0.0.0-20191115094559-17f92b0546e8/go.mod h1:p+ivJws3dpqbp1iP84+npOyAmTTOLMgCzrXd3GSdn/A= github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7 h1:Pc5TCv9mbxFN6UVX0LH6CpQrdTM5YjbVI2w15237Pjk= @@ -304,7 +226,6 @@ github.com/hashicorp/terraform-plugin-test v1.2.0 h1:AWFdqyfnOj04sxTdaAF57QqvW7X github.com/hashicorp/terraform-plugin-test v1.2.0/go.mod h1:QIJHYz8j+xJtdtLrFTlzQVC0ocr3rf/OjIpgZLK56Hs= github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596 h1:hjyO2JsNZUKT1ym+FAdlBEkGPevazYsmVgIMw7dVELg= github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= -github.com/hashicorp/vault v0.10.4/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= @@ -321,14 +242,10 @@ github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5i github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/joyent/triton-go v0.0.0-20180313100802-d8f9c0314926/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= -github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= @@ -353,22 +270,12 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/likexian/gokit v0.0.0-20190309162924-0a377eecf7aa/go.mod h1:QdfYv6y6qPA9pbBA2qXtoT8BMKha6UyNbxWGWl/9Jfk= -github.com/likexian/gokit v0.0.0-20190418170008-ace88ad0983b/go.mod h1:KKqSnk/VVSW8kEyO2vVCXoanzEutKdlBAPohmGXkxCk= -github.com/likexian/gokit v0.0.0-20190501133040-e77ea8b19cdc/go.mod h1:3kvONayqCaj+UgrRZGpgfXzHdMYCAO0KAt4/8n0L57Y= -github.com/likexian/gokit v0.20.15/go.mod h1:kn+nTv3tqh6yhor9BC4Lfiu58SmH8NmQ2PmEl+uM6nU= -github.com/likexian/simplejson-go v0.0.0-20190409170913-40473a74d76d/go.mod h1:Typ1BfnATYtZ/+/shXfFYLrovhFyuKvzwrdOnIDHlmg= -github.com/likexian/simplejson-go v0.0.0-20190419151922-c1f9f0b4f084/go.mod h1:U4O1vIJvIKwbMZKUJ62lppfdvkCdVd2nfMimHK81eec= -github.com/likexian/simplejson-go v0.0.0-20190502021454-d8787b4bfa0b/go.mod h1:3BWwtmKP9cXWwYCr5bkoVDEfLywacOv0s06OBEDpyt8= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/lusis/go-artifactory v0.0.0-20160115162124-7e4ce345df82/go.mod h1:y54tfGmO3NKssKveTEFFzH8C/akrSOy/iW9qEAUDV84= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/maratori/testpackage v1.0.1 h1:QtJ5ZjqapShm0w5DosRjg0PRlSdAdlx+W6cCKoALdbQ= github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= -github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= -github.com/masterzen/winrm v0.0.0-20190223112901-5e5c9a7fe54b/go.mod h1:wr1VqkwW0AB5JS0QLy5GpVMS9E3VtRoSYXUYyVk46KY= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb h1:RHba4YImhrUVQDHUCe2BNSOz4tVy2yGyXhvYDvxGgeE= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -383,11 +290,9 @@ github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-shellwords v1.0.4/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.8/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0 h1:iGBIsUe3+HZ/AD/Vd7DErOt5sU9fa8Uj7A2s1aggv1Y= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= @@ -397,7 +302,6 @@ github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFW github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-linereader v0.0.0-20190213213312-1b945b3263eb/go.mod h1:OaY7UOoTkkrX3wRwjpYRKafIkkyeD0UtweSHAWWiqQM= github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= @@ -405,19 +309,12 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/hashstructure v1.0.0 h1:ZkRJX1CyOoTkar7p/mLS5TZU4nJ1Rn/F8u9dGS02Q3Y= -github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/panicwrap v1.0.0/go.mod h1:pKvZHwWrZowLUzftuFq7coarnxbBXU4aQh3N0BJOeeA= -github.com/mitchellh/prefixedio v0.0.0-20190213213902-5733675afd51/go.mod h1:kB1naBgV9ORnkiTVeyJOI1DavaJkG4oNIq0Af6ZVKUo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE= github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mozilla/tls-observatory v0.0.0-20200220173314-aae45faa4006/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= -github.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nakabonne/nestif v0.3.0 h1:+yOViDGhg8ygGrmII72nV9B/zGxY188TYpfolntsaPw= github.com/nakabonne/nestif v0.3.0/go.mod h1:dI314BppzXjJ4HsCnbo7XzrJHPszZsjnk5wEBSYHI2c= @@ -425,7 +322,6 @@ github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1 github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -435,14 +331,11 @@ github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0 github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= -github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -452,16 +345,12 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr github.com/posener/complete v1.2.1 h1:LrvDIY//XNo65Lq84G/akBuMGlawHvGBABv8f/ZN6DI= github.com/posener/complete v1.2.1/go.mod h1:6gapUrK/U1TAN7ciCoNRIdVC5sbdBTUh1DKN0g6uH7E= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= @@ -470,16 +359,12 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/ryancurrah/gomodguard v1.0.4 h1:oCreMAt9GuFXDe9jW4HBpc3GjdX3R/sUEcLAGh1zPx8= github.com/ryancurrah/gomodguard v1.0.4/go.mod h1:9T/Cfuxs5StfsocWr4WzDL36HqnX0fVb9d5fSEaLhoE= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/securego/gosec v0.0.0-20200316084457-7da9f46445fd h1:qB+l4fYZsH78xORC1aqVS0zNmgkQp4rkj2rvfxQMtzc= github.com/securego/gosec v0.0.0-20200316084457-7da9f46445fd/go.mod h1:NurAFZsWJAEZjogSwdVPlHkOZB3DOAU7gsPP8VFZCHc= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= -github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0 h1:T9uus1QvcPgeLShS30YOnnzk3r9Vvygp45muhlrufgY= -github.com/shurcooL/githubv4 v0.0.0-20191127044304-8f68eb5628d0/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= github.com/shurcooL/githubv4 v0.0.0-20201206200315-234843c633fa h1:jozR3igKlnYCj9IVHOVump59bp07oIRoLQ/CcjMYIUA= github.com/shurcooL/githubv4 v0.0.0-20201206200315-234843c633fa/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e h1:MZM7FHLqUHYI0Y/mQAt3d2aYa0SiNms/hFqC9qJYolM= @@ -493,7 +378,6 @@ github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4 github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -501,7 +385,6 @@ github.com/sourcegraph/go-diff v0.5.1 h1:gO6i5zugwzo1RVTvgvfwCOSVegNuvnNi6bAD1QC github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34cd2MNlA9u1mE= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.2.1/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= @@ -529,21 +412,15 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/svanharmelen/jsonapi v0.0.0-20180618144545-0c0828c3f16d/go.mod h1:BSTlc8jOjh0niykqEGVXOLXdi9o0r0kR8tCYiMvjFgw= github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 h1:Xr9gkxfOP0KQWXKNqmwe8vEeSUiUj4Rlee9CMVX2ZUQ= github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= -github.com/tencentcloud/tencentcloud-sdk-go v3.0.82+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= -github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20190808065407-f07404cefc8c/go.mod h1:wk2XFUg6egk4tSDNZtXeKfe2G6690UVyt163PuUxBZk= -github.com/terraform-providers/terraform-provider-openstack v1.15.0/go.mod h1:2aQ6n/BtChAl1y2S60vebhyJyZXBsuAI5G4+lHrT1Ew= github.com/tetafro/godot v0.2.5 h1:7+EYJM/Z4gYZhBFdRrVm6JTj5ZLw/QI1j4RfEOXJviE= github.com/tetafro/godot v0.2.5/go.mod h1:pT6/T8+h6//L/LwQcFc4C0xpfy1euZwzS1sHdrFCms0= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= -github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa h1:RC4maTWLKKwb7p1cnoygsbKIgNlJqSYBeAFON3Ar8As= github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= -github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= @@ -561,10 +438,7 @@ github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.1+incompatible h1:RMF1enSPeKTlXrXdOcqjFUElywVZjjC6pqse21bKbEU= github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= -github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= @@ -578,20 +452,15 @@ go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw= @@ -618,7 +487,6 @@ golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -652,7 +520,6 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -742,7 +609,6 @@ gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= diff --git a/vendor/github.com/hashicorp/terraform/LICENSE b/vendor/github.com/hashicorp/terraform/LICENSE deleted file mode 100644 index c33dcc7c92..0000000000 --- a/vendor/github.com/hashicorp/terraform/LICENSE +++ /dev/null @@ -1,354 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/terraform/helper/acctest/acctest.go b/vendor/github.com/hashicorp/terraform/helper/acctest/acctest.go deleted file mode 100644 index 9d31031a47..0000000000 --- a/vendor/github.com/hashicorp/terraform/helper/acctest/acctest.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package acctest contains for Terraform Acceptance Tests -package acctest diff --git a/vendor/github.com/hashicorp/terraform/helper/acctest/random.go b/vendor/github.com/hashicorp/terraform/helper/acctest/random.go deleted file mode 100644 index 258e4db70f..0000000000 --- a/vendor/github.com/hashicorp/terraform/helper/acctest/random.go +++ /dev/null @@ -1,176 +0,0 @@ -package acctest - -import ( - "bytes" - crand "crypto/rand" - "crypto/rsa" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "fmt" - "math/big" - "math/rand" - "net" - "strings" - "time" - - "golang.org/x/crypto/ssh" - - "github.com/apparentlymart/go-cidr/cidr" -) - -func init() { - rand.Seed(time.Now().UTC().UnixNano()) -} - -// Helpers for generating random tidbits for use in identifiers to prevent -// collisions in acceptance tests. - -// RandInt generates a random integer -func RandInt() int { - return rand.New(rand.NewSource(time.Now().UnixNano())).Int() -} - -// RandomWithPrefix is used to generate a unique name with a prefix, for -// randomizing names in acceptance tests -func RandomWithPrefix(name string) string { - return fmt.Sprintf("%s-%d", name, rand.New(rand.NewSource(time.Now().UnixNano())).Int()) -} - -func RandIntRange(min int, max int) int { - source := rand.New(rand.NewSource(time.Now().UnixNano())) - rangeMax := max - min - - return int(source.Int31n(int32(rangeMax))) -} - -// RandString generates a random alphanumeric string of the length specified -func RandString(strlen int) string { - return RandStringFromCharSet(strlen, CharSetAlphaNum) -} - -// RandStringFromCharSet generates a random string by selecting characters from -// the charset provided -func RandStringFromCharSet(strlen int, charSet string) string { - result := make([]byte, strlen) - for i := 0; i < strlen; i++ { - result[i] = charSet[rand.Intn(len(charSet))] - } - return string(result) -} - -// RandSSHKeyPair generates a public and private SSH key pair. The public key is -// returned in OpenSSH format, and the private key is PEM encoded. -func RandSSHKeyPair(comment string) (string, string, error) { - privateKey, privateKeyPEM, err := genPrivateKey() - if err != nil { - return "", "", err - } - - publicKey, err := ssh.NewPublicKey(&privateKey.PublicKey) - if err != nil { - return "", "", err - } - keyMaterial := strings.TrimSpace(string(ssh.MarshalAuthorizedKey(publicKey))) - return fmt.Sprintf("%s %s", keyMaterial, comment), privateKeyPEM, nil -} - -// RandTLSCert generates a self-signed TLS certificate with a newly created -// private key, and returns both the cert and the private key PEM encoded. -func RandTLSCert(orgName string) (string, string, error) { - template := &x509.Certificate{ - SerialNumber: big.NewInt(int64(RandInt())), - Subject: pkix.Name{ - Organization: []string{orgName}, - }, - NotBefore: time.Now(), - NotAfter: time.Now().Add(24 * time.Hour), - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - } - - privateKey, privateKeyPEM, err := genPrivateKey() - if err != nil { - return "", "", err - } - - cert, err := x509.CreateCertificate(crand.Reader, template, template, &privateKey.PublicKey, privateKey) - if err != nil { - return "", "", err - } - - certPEM, err := pemEncode(cert, "CERTIFICATE") - if err != nil { - return "", "", err - } - - return certPEM, privateKeyPEM, nil -} - -// RandIpAddress returns a random IP address in the specified CIDR block. -// The prefix length must be less than 31. -func RandIpAddress(s string) (string, error) { - _, network, err := net.ParseCIDR(s) - if err != nil { - return "", err - } - - firstIp, lastIp := cidr.AddressRange(network) - first := &big.Int{} - first.SetBytes([]byte(firstIp)) - last := &big.Int{} - last.SetBytes([]byte(lastIp)) - r := &big.Int{} - r.Sub(last, first) - if len := r.BitLen(); len > 31 { - return "", fmt.Errorf("CIDR range is too large: %d", len) - } - - max := int(r.Int64()) - if max == 0 { - // panic: invalid argument to Int31n - return firstIp.String(), nil - } - - host, err := cidr.Host(network, RandIntRange(0, max)) - if err != nil { - return "", err - } - - return host.String(), nil -} - -func genPrivateKey() (*rsa.PrivateKey, string, error) { - privateKey, err := rsa.GenerateKey(crand.Reader, 1024) - if err != nil { - return nil, "", err - } - - privateKeyPEM, err := pemEncode(x509.MarshalPKCS1PrivateKey(privateKey), "RSA PRIVATE KEY") - if err != nil { - return nil, "", err - } - - return privateKey, privateKeyPEM, nil -} - -func pemEncode(b []byte, block string) (string, error) { - var buf bytes.Buffer - pb := &pem.Block{Type: block, Bytes: b} - if err := pem.Encode(&buf, pb); err != nil { - return "", err - } - - return buf.String(), nil -} - -const ( - // CharSetAlphaNum is the alphanumeric character set for use with - // RandStringFromCharSet - CharSetAlphaNum = "abcdefghijklmnopqrstuvwxyz012346789" - - // CharSetAlpha is the alphabetical character set for use with - // RandStringFromCharSet - CharSetAlpha = "abcdefghijklmnopqrstuvwxyz" -) diff --git a/vendor/github.com/hashicorp/terraform/helper/acctest/remotetests.go b/vendor/github.com/hashicorp/terraform/helper/acctest/remotetests.go deleted file mode 100644 index 87c60b8be4..0000000000 --- a/vendor/github.com/hashicorp/terraform/helper/acctest/remotetests.go +++ /dev/null @@ -1,27 +0,0 @@ -package acctest - -import ( - "net/http" - "os" - "testing" -) - -// SkipRemoteTestsEnvVar is an environment variable that can be set by a user -// running the tests in an environment with limited network connectivity. By -// default, tests requiring internet connectivity make an effort to skip if no -// internet is available, but in some cases the smoke test will pass even -// though the test should still be skipped. -const SkipRemoteTestsEnvVar = "TF_SKIP_REMOTE_TESTS" - -// RemoteTestPrecheck is meant to be run by any unit test that requires -// outbound internet connectivity. The test will be skipped if it's -// unavailable. -func RemoteTestPrecheck(t *testing.T) { - if os.Getenv(SkipRemoteTestsEnvVar) != "" { - t.Skipf("skipping test, %s was set", SkipRemoteTestsEnvVar) - } - - if _, err := http.Get("http://google.com"); err != nil { - t.Skipf("skipping, internet seems to not be available: %s", err) - } -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 73d13f6b57..b15d99d3cd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -235,8 +235,6 @@ github.com/hashicorp/hcl/v2/hclwrite github.com/hashicorp/hcl/v2/json # github.com/hashicorp/logutils v1.0.0 github.com/hashicorp/logutils -# github.com/hashicorp/terraform v0.12.24 -github.com/hashicorp/terraform/helper/acctest # github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7 github.com/hashicorp/terraform-config-inspect/tfconfig # github.com/hashicorp/terraform-json v0.4.0 From 75d6a3e547b864bdaa1e51004c072f2d8a0baf3c Mon Sep 17 00:00:00 2001 From: John Losito Date: Sat, 16 Jan 2021 18:31:07 -0500 Subject: [PATCH 23/45] Allow dependabot to check go dependencies (#653) --- .github/dependabot.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5ace4600a1..603f653293 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,3 +4,8 @@ updates: directory: "/" schedule: interval: "weekly" + + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "weekly" From 3a9dbb06fc3be04ea64ba89b67f38f313f31f6aa Mon Sep 17 00:00:00 2001 From: Oleksandr Dievri Date: Tue, 19 Jan 2021 15:59:37 +0200 Subject: [PATCH 24/45] Fix link to Milestones page (#663) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b80ddf0429..43e6c12c45 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Detailed documentation for contributing to the GitHub provider can be found [her ## Roadmap -This project leverages [Milestones](https://github.com/terraform-providers/terraform-provider-github/milestones) to scope upcoming features and bug fixes. Issues that receive the most recent discussion or the most reactions will be more likely to be included in an upcoming release. +This project leverages [Milestones](https://github.com/integrations/terraform-provider-github/milestones) to scope upcoming features and bug fixes. Issues that receive the most recent discussion or the most reactions will be more likely to be included in an upcoming release. ## Support From b61a71f76dcba29fcda9ad64e6a8ea8c42d09bd9 Mon Sep 17 00:00:00 2001 From: Dee Kryvenko <109895+dee-kryvenko@users.noreply.github.com> Date: Fri, 22 Jan 2021 14:41:42 -0800 Subject: [PATCH 25/45] github_branch_default: send only fields that changed. Fixes #625 #620. (#666) * github_branch_default: send only fields that changed. Fixes #625 #620. * fix failing test and update docs Co-authored-by: Jeremy Udit --- github/resource_github_branch_default.go | 30 +++++++------------ github/resource_github_branch_default_test.go | 22 +++++++------- website/docs/r/branch_default.html.markdown | 10 ++----- 3 files changed, 25 insertions(+), 37 deletions(-) diff --git a/github/resource_github_branch_default.go b/github/resource_github_branch_default.go index 893209796b..279b2de766 100644 --- a/github/resource_github_branch_default.go +++ b/github/resource_github_branch_default.go @@ -4,6 +4,7 @@ import ( "context" "log" + "github.com/google/go-github/v32/github" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) @@ -38,14 +39,11 @@ func resourceGithubBranchDefaultCreate(d *schema.ResourceData, meta interface{}) repoName := d.Get("repository").(string) defaultBranch := d.Get("branch").(string) - ctx := context.Background() - - repository, _, err := client.Repositories.Get(ctx, owner, repoName) - if err != nil { - return err + repository := &github.Repository{ + DefaultBranch: &defaultBranch, } - repository.DefaultBranch = &defaultBranch + ctx := context.Background() log.Printf("[DEBUG] Creating branch default: %s (%s/%s)", defaultBranch, owner, repoName) if _, _, err := client.Repositories.Edit(ctx, owner, repoName, repository); err != nil { @@ -87,17 +85,14 @@ func resourceGithubBranchDefaultDelete(d *schema.ResourceData, meta interface{}) repoName := d.Id() defaultBranch := d.Get("branch").(string) - ctx := context.Background() - - repository, _, err := client.Repositories.Get(ctx, owner, repoName) - if err != nil { - return err + repository := &github.Repository{ + DefaultBranch: nil, } - repository.DefaultBranch = nil + ctx := context.Background() log.Printf("[DEBUG] Removing branch default: %s (%s/%s)", defaultBranch, owner, repoName) - _, _, err = client.Repositories.Edit(ctx, owner, repoName, repository) + _, _, err := client.Repositories.Edit(ctx, owner, repoName, repository) return err } @@ -108,14 +103,11 @@ func resourceGithubBranchDefaultUpdate(d *schema.ResourceData, meta interface{}) repoName := d.Id() defaultBranch := d.Get("branch").(string) - ctx := context.Background() - - repository, _, err := client.Repositories.Get(ctx, owner, repoName) - if err != nil { - return err + repository := &github.Repository{ + DefaultBranch: &defaultBranch, } - repository.DefaultBranch = &defaultBranch + ctx := context.Background() log.Printf("[DEBUG] Updating branch default: %s (%s/%s)", defaultBranch, owner, repoName) if _, _, err := client.Repositories.Edit(ctx, owner, repoName, repository); err != nil { diff --git a/github/resource_github_branch_default_test.go b/github/resource_github_branch_default_test.go index f01b67c87b..5ab1b8a3a1 100644 --- a/github/resource_github_branch_default_test.go +++ b/github/resource_github_branch_default_test.go @@ -65,18 +65,22 @@ func TestAccGithubBranchDefault(t *testing.T) { }) - t.Run("can be configured to override the default_branch of the repository", func(t *testing.T) { + t.Run("replaces the default_branch of a repository", func(t *testing.T) { config := fmt.Sprintf(` resource "github_repository" "test" { name = "tf-acc-test-%s" - default_branch = "main" auto_init = true } - - resource "github_branch_default" "test" { - repository = github_repository.test.name - branch = "override" + + resource "github_branch" "test" { + repository = github_repository.test.name + branch = "test" + } + + resource "github_branch_default" "test"{ + repository = github_repository.test.name + branch = github_branch.test.branch } `, randomID) @@ -84,11 +88,7 @@ func TestAccGithubBranchDefault(t *testing.T) { check := resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr( "github_branch_default.test", "branch", - "override", - ), - resource.TestCheckResourceAttr( - "github_branch_default.test", "repository", - fmt.Sprintf("tf-acc-test-%s", randomID), + "test", ), ) diff --git a/website/docs/r/branch_default.html.markdown b/website/docs/r/branch_default.html.markdown index cfc11623ce..bc8056ede1 100644 --- a/website/docs/r/branch_default.html.markdown +++ b/website/docs/r/branch_default.html.markdown @@ -11,19 +11,15 @@ Provides a GitHub branch default resource. This resource allows you to set the default branch for a given repository. +Note that use of this resource is incompatible with the `default_branch` option of the `github_repository` resource. Using both will result in plans always showing a diff. + ## Example Usage ```hcl resource "github_repository" "example" { name = "example" description = "My awesome codebase" - - visibility = "private" - - template { - owner = "github" - repository = "terraform-module-template" - } + auto_init = true } resource "github_branch" "development" { From ec33896b37a3e7b81d6bbf45ef55d24090b8487e Mon Sep 17 00:00:00 2001 From: Ravi <1299606+rustycl0ck@users.noreply.github.com> Date: Fri, 22 Jan 2021 22:42:27 +0000 Subject: [PATCH 26/45] Fix error handling (#668) Do not silently proceed further on receiving an error response. Signed-off-by: rustyclock --- github/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/github/config.go b/github/config.go index 2d8445e961..a7bc53694f 100644 --- a/github/config.go +++ b/github/config.go @@ -115,6 +115,8 @@ func (c *Config) ConfigureOwner(owner *Owner) (*Owner, error) { owner.id = remoteOrg.GetID() owner.IsOrganization = true } + } else { + return nil, err } } @@ -210,6 +212,8 @@ func (c *Config) Clients() (interface{}, error) { owner.id = remoteOrg.GetID() owner.IsOrganization = true } + } else { + return nil, err } } return &owner, nil From dec1456e4c1c612fec1ffee8335f89d6015a9a53 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Fri, 22 Jan 2021 17:53:39 -0500 Subject: [PATCH 27/45] Update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94e2e335c7..409d61df04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 4.3.1 (January 22, 2021) + +BUG FIXES: + +* Send valid payload when editing a repository resource with `github_branch_default` ([#666](https://github.com/terraform-providers/terraform-provider-github/issues/666)) +* Add handling to surface errors in provider configuration ([#668](https://github.com/terraform-providers/terraform-provider-github/issues/668)) + ## 4.3.0 (January 14, 2021) ENHANCEMENTS: From b4ebe6d57c9d3967d38a56e0db79ce7ea43840e7 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Fri, 22 Jan 2021 18:11:22 -0500 Subject: [PATCH 28/45] Remove Obsolete Test My understanding is our use of Terraform Registry makes this failing test unnecessary. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0b1c6e81f6..803e5558a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,5 +27,3 @@ matrix: script: make test - name: "make website-lint" script: make website-lint - - name: "make website-test" - script: make website-test From 54371c9b697606f8c1032961a6c73ade151f9a13 Mon Sep 17 00:00:00 2001 From: Alexis Gauthiez Date: Wed, 27 Jan 2021 00:16:01 +0100 Subject: [PATCH 29/45] Update GitHub organization references (#672) Following the project transfer from `terraform-providers` organization to `integrations`. --- CHANGELOG.md | 302 +++++++++++----------- CONTRIBUTING.md | 2 +- examples/README.md | 2 +- github/resource_github_repository_test.go | 2 +- github/resource_github_team_membership.go | 2 +- 5 files changed, 155 insertions(+), 155 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 409d61df04..3db647ea39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,15 @@ BUG FIXES: -* Send valid payload when editing a repository resource with `github_branch_default` ([#666](https://github.com/terraform-providers/terraform-provider-github/issues/666)) -* Add handling to surface errors in provider configuration ([#668](https://github.com/terraform-providers/terraform-provider-github/issues/668)) +* Send valid payload when editing a repository resource with `github_branch_default` ([#666](https://github.com/integrations/terraform-provider-github/issues/666)) +* Add handling to surface errors in provider configuration ([#668](https://github.com/integrations/terraform-provider-github/issues/668)) ## 4.3.0 (January 14, 2021) ENHANCEMENTS: -* **New Resource** `github_branch_protection_v3` ([#642](https://github.com/terraform-providers/terraform-provider-github/issues/642)) -* Add `pages` feature to `github_repository` ([#490](https://github.com/terraform-providers/terraform-provider-github/issues/490)) +* **New Resource** `github_branch_protection_v3` ([#642](https://github.com/integrations/terraform-provider-github/issues/642)) +* Add `pages` feature to `github_repository` ([#490](https://github.com/integrations/terraform-provider-github/issues/490)) ## 4.2.0 (January 07, 2021) @@ -22,82 +22,82 @@ BREAKING CHANGES: ENHANCEMENTS: -- Add `allowDeletions` and `allowsForcePushes` to `github_branch_protection` ([#623](https://github.com/terraform-providers/terraform-provider-github/pull/623)) -- Add GitHub App actor support to `github_branch_protection` ([#615](https://github.com/terraform-providers/terraform-provider-github/pull/615)) +- Add `allowDeletions` and `allowsForcePushes` to `github_branch_protection` ([#623](https://github.com/integrations/terraform-provider-github/pull/623)) +- Add GitHub App actor support to `github_branch_protection` ([#615](https://github.com/integrations/terraform-provider-github/pull/615)) BUG FIXES: -- Allow `required_status_checks` `strict` to be `false` for `github_branch_protection` ([#614](https://github.com/terraform-providers/terraform-provider-github/pull/614)) -- Remove `ForceNew` on template-related options for `github_repository` ([#609](https://github.com/terraform-providers/terraform-provider-github/pull/609)) -- Fix parsing of input during imports of `github_branch_protection` ([#610](https://github.com/terraform-providers/terraform-provider-github/pull/610)) -- `github_repository_file` resource no longer iterates through all commits ([#644](https://github.com/terraform-providers/terraform-provider-github/pull/644)) +- Allow `required_status_checks` `strict` to be `false` for `github_branch_protection` ([#614](https://github.com/integrations/terraform-provider-github/pull/614)) +- Remove `ForceNew` on template-related options for `github_repository` ([#609](https://github.com/integrations/terraform-provider-github/pull/609)) +- Fix parsing of input during imports of `github_branch_protection` ([#610](https://github.com/integrations/terraform-provider-github/pull/610)) +- `github_repository_file` resource no longer iterates through all commits ([#644](https://github.com/integrations/terraform-provider-github/pull/644)) ## 4.1.0 (December 01, 2020) ENHANCEMENTS: -- Add `github_actions_organization_secret` resource ([#261](https://github.com/terraform-providers/terraform-provider-github/pull/261)) -- Add `github_repository_milestone` resource ([#470](https://github.com/terraform-providers/terraform-provider-github/pull/470)) -- Add `github_repository_milestone` data source ([#470](https://github.com/terraform-providers/terraform-provider-github/pull/470)) -- Add `github_project_card` resource ([#460](https://github.com/terraform-providers/terraform-provider-github/pull/460)) -- Add `github_branch_default` resource ([#194](https://github.com/terraform-providers/terraform-provider-github/pull/194)) +- Add `github_actions_organization_secret` resource ([#261](https://github.com/integrations/terraform-provider-github/pull/261)) +- Add `github_repository_milestone` resource ([#470](https://github.com/integrations/terraform-provider-github/pull/470)) +- Add `github_repository_milestone` data source ([#470](https://github.com/integrations/terraform-provider-github/pull/470)) +- Add `github_project_card` resource ([#460](https://github.com/integrations/terraform-provider-github/pull/460)) +- Add `github_branch_default` resource ([#194](https://github.com/integrations/terraform-provider-github/pull/194)) ## 4.0.1 (November 18, 2020) BUG FIXES: -- `github_team` data source query no longer iterates through a list of teams ([#579](https://github.com/terraform-providers/terraform-provider-github/pull/579)) -- `github_repository_file` resource no longer iterates through all commits ([#589](https://github.com/terraform-providers/terraform-provider-github/pull/589)) -- fix parsing of `repo:pattern` format during `github_branch_protection` import ([#599](https://github.com/terraform-providers/terraform-provider-github/pull/599)) +- `github_team` data source query no longer iterates through a list of teams ([#579](https://github.com/integrations/terraform-provider-github/pull/579)) +- `github_repository_file` resource no longer iterates through all commits ([#589](https://github.com/integrations/terraform-provider-github/pull/589)) +- fix parsing of `repo:pattern` format during `github_branch_protection` import ([#599](https://github.com/integrations/terraform-provider-github/pull/599)) ## 4.0.0 (November 10, 2020) REGRESSIONS: -- fails parsing of `repo:pattern` format during `github_branch_protection` import ([#597](https://github.com/terraform-providers/terraform-provider-github/issues/597)) +- fails parsing of `repo:pattern` format during `github_branch_protection` import ([#597](https://github.com/integrations/terraform-provider-github/issues/597)) BREAKING CHANGES: -- `pattern` replaces `branch` in changes to `github_branch_protection` introduced in `v3.1.0` ([#566](https://github.com/terraform-providers/terraform-provider-github/issues/566)) -- `dismissal_restrictions` documented for `github_branch_protection` ([#569](https://github.com/terraform-providers/terraform-provider-github/pull/569)) -- project license changes from MPL2 to MIT ([#591](https://github.com/terraform-providers/terraform-provider-github/pull/591)) +- `pattern` replaces `branch` in changes to `github_branch_protection` introduced in `v3.1.0` ([#566](https://github.com/integrations/terraform-provider-github/issues/566)) +- `dismissal_restrictions` documented for `github_branch_protection` ([#569](https://github.com/integrations/terraform-provider-github/pull/569)) +- project license changes from MPL2 to MIT ([#591](https://github.com/integrations/terraform-provider-github/pull/591)) BUG FIXES: -- `repository_id` for `github_branch_protection` accepts repository name as well as node ID ([#593](https://github.com/terraform-providers/terraform-provider-github/issues/593)) +- `repository_id` for `github_branch_protection` accepts repository name as well as node ID ([#593](https://github.com/integrations/terraform-provider-github/issues/593)) ENHANCEMENTS: -- Add support to get currently authenticated user to `data_source_github_user` ([#261](https://github.com/terraform-providers/terraform-provider-github/pull/261)) -- Add importing to `github_organization_webhook` ([#487](https://github.com/terraform-providers/terraform-provider-github/pull/487)) +- Add support to get currently authenticated user to `data_source_github_user` ([#261](https://github.com/integrations/terraform-provider-github/pull/261)) +- Add importing to `github_organization_webhook` ([#487](https://github.com/integrations/terraform-provider-github/pull/487)) ## 3.1.0 (October 12, 2020) REGRESSIONS: -- undocumented, breaking configuration changes to `github_branch_protection` ([#566](https://github.com/terraform-providers/terraform-provider-github/issues/566)) -- slowed performance of `github_branch_protection` ([$567](https://github.com/terraform-providers/terraform-provider-github/issues/567)) -- change to default branch breaks refresh of existing `github_repository_file` resources ([#564](https://github.com/terraform-providers/terraform-provider-github/issues/564)) +- undocumented, breaking configuration changes to `github_branch_protection` ([#566](https://github.com/integrations/terraform-provider-github/issues/566)) +- slowed performance of `github_branch_protection` ([$567](https://github.com/integrations/terraform-provider-github/issues/567)) +- change to default branch breaks refresh of existing `github_repository_file` resources ([#564](https://github.com/integrations/terraform-provider-github/issues/564)) BREAKING CHANGES: -- Deprecate `anonymous` Flag For Provider Configuration ([#506](https://github.com/terraform-providers/terraform-provider-github/issues/506)) +- Deprecate `anonymous` Flag For Provider Configuration ([#506](https://github.com/integrations/terraform-provider-github/issues/506)) BUG FIXES: -- re-instante resources unavailable in the context of an organization ([#501](https://github.com/terraform-providers/terraform-provider-github/issues/501)) -- allow overwrite-on-create behaviour for `github_repository_file` resource ([#459](https://github.com/terraform-providers/terraform-provider-github/issues/459)) +- re-instante resources unavailable in the context of an organization ([#501](https://github.com/integrations/terraform-provider-github/issues/501)) +- allow overwrite-on-create behaviour for `github_repository_file` resource ([#459](https://github.com/integrations/terraform-provider-github/issues/459)) ENHANCEMENTS: -- update `go-github` to `v32.1.0` ([#475](https://github.com/terraform-providers/terraform-provider-github/issues/475)) -- add `vulnerability_alerts` to `github_repository` ([#444](https://github.com/terraform-providers/terraform-provider-github/issues/444)) -- add `archive_on_destroy` to `github_repository` ([#432](https://github.com/terraform-providers/terraform-provider-github/issues/432)) -- uplift `branch_protection` to GraphQL ([#337](https://github.com/terraform-providers/terraform-provider-github/issues/337)) +- update `go-github` to `v32.1.0` ([#475](https://github.com/integrations/terraform-provider-github/issues/475)) +- add `vulnerability_alerts` to `github_repository` ([#444](https://github.com/integrations/terraform-provider-github/issues/444)) +- add `archive_on_destroy` to `github_repository` ([#432](https://github.com/integrations/terraform-provider-github/issues/432)) +- uplift `branch_protection` to GraphQL ([#337](https://github.com/integrations/terraform-provider-github/issues/337)) ## 3.0.0 (September 08, 2020) @@ -112,18 +112,18 @@ BREAKING CHANGES: BUG FIXES: -- `terraform validate` fails because of missing token ([#503](https://github.com/terraform-providers/terraform-provider-github/issues/503)) -- organization support for various resources ([#501](https://github.com/terraform-providers/terraform-provider-github/issues/501)) +- `terraform validate` fails because of missing token ([#503](https://github.com/integrations/terraform-provider-github/issues/503)) +- organization support for various resources ([#501](https://github.com/integrations/terraform-provider-github/issues/501)) ENHANCEMENTS: -* **New Data Source** `github_organization` ([#521](https://github.com/terraform-providers/terraform-provider-github/issues/521)) +* **New Data Source** `github_organization` ([#521](https://github.com/integrations/terraform-provider-github/issues/521)) ## 2.9.2 (July 14, 2020) -- Adds deprecation of `anonymous` flag for provider configuration ahead of next major release ([#506](https://github.com/terraform-providers/terraform-provider-github/issues/506)) -- Adds deprecation of `individual` flag for provider configuration ahead of next major release ([#512](https://github.com/terraform-providers/terraform-provider-github/issues/512)) +- Adds deprecation of `anonymous` flag for provider configuration ahead of next major release ([#506](https://github.com/integrations/terraform-provider-github/issues/506)) +- Adds deprecation of `individual` flag for provider configuration ahead of next major release ([#512](https://github.com/integrations/terraform-provider-github/issues/512)) ## 2.9.1 (July 01, 2020) @@ -134,90 +134,90 @@ BUG FIXES: ## 2.9.0 (June 29, 2020) **NOTE**: This release introduced a provider-level breaking change around `anonymous` use. -See [here](https://github.com/terraform-providers/terraform-provider-github/pull/464#discussion_r427961161) for details and [here](https://github.com/terraform-providers/terraform-provider-github/issues/502#issuecomment-652379322) to discuss a fix. +See [here](https://github.com/integrations/terraform-provider-github/pull/464#discussion_r427961161) for details and [here](https://github.com/integrations/terraform-provider-github/issues/502#issuecomment-652379322) to discuss a fix. ENHANCEMENTS: -* Add Ability To Manage Resources For Non-Organization Accounts ([#464](https://github.com/terraform-providers/terraform-provider-github/issues/464)) -* resource/github_repository: Add "internal" Visibility Option ([#454](https://github.com/terraform-providers/terraform-provider-github/issues/454)) +* Add Ability To Manage Resources For Non-Organization Accounts ([#464](https://github.com/integrations/terraform-provider-github/issues/464)) +* resource/github_repository: Add "internal" Visibility Option ([#454](https://github.com/integrations/terraform-provider-github/issues/454)) ## 2.8.1 (June 09, 2020) BUG FIXES: -* resource/github_repository_file: Reduce API requests when looping through commits ([[#466](https://github.com/terraform-providers/terraform-provider-github/issues/466)]) -* resource/github_repository: Fix `auto_init` Destroying Repositories ([[#317](https://github.com/terraform-providers/terraform-provider-github/issues/317)]) -* resource/github_repository_deploy_key: Fix acceptance test approach ([[#471](https://github.com/terraform-providers/terraform-provider-github/issues/471)]) -* resource/github_actions_secret: Fix Case Where Secret Removed Outside Of Terraform ([[#482](https://github.com/terraform-providers/terraform-provider-github/issues/482)]) +* resource/github_repository_file: Reduce API requests when looping through commits ([[#466](https://github.com/integrations/terraform-provider-github/issues/466)]) +* resource/github_repository: Fix `auto_init` Destroying Repositories ([[#317](https://github.com/integrations/terraform-provider-github/issues/317)]) +* resource/github_repository_deploy_key: Fix acceptance test approach ([[#471](https://github.com/integrations/terraform-provider-github/issues/471)]) +* resource/github_actions_secret: Fix Case Where Secret Removed Outside Of Terraform ([[#482](https://github.com/integrations/terraform-provider-github/issues/482)]) * Documentation Addition Of `examples/` Directory ## 2.8.0 (May 15, 2020) BUG FIXES: -* resource/github_branch_protection: Prevent enabling `dismissal_restrictions` in Github console if `dismissal_users` and `dismissal_teams` are not set ([#453](https://github.com/terraform-providers/terraform-provider-github/issues/453)) -* resource/github_repository_collaborator: Allow modifying permissions from `maintain` and `triage` ([#457](https://github.com/terraform-providers/terraform-provider-github/issues/457)) -* Documentation Fix for `github_actions_public_key` data-source ([#458](https://github.com/terraform-providers/terraform-provider-github/issues/458)) -* Documentation Fix for `github_branch_protection` resource ([#410](https://github.com/terraform-providers/terraform-provider-github/issues/410)) -* Documentation Layout Fix for `github_ip_ranges` and `github_membership` data sources ([#423](https://github.com/terraform-providers/terraform-provider-github/issues/423)) -* Documentation Fix for `github_repository_file` import ([#443](https://github.com/terraform-providers/terraform-provider-github/issues/443)) -* Update `go-github` to `v31.0.0` ([#424](https://github.com/terraform-providers/terraform-provider-github/issues/424)) +* resource/github_branch_protection: Prevent enabling `dismissal_restrictions` in Github console if `dismissal_users` and `dismissal_teams` are not set ([#453](https://github.com/integrations/terraform-provider-github/issues/453)) +* resource/github_repository_collaborator: Allow modifying permissions from `maintain` and `triage` ([#457](https://github.com/integrations/terraform-provider-github/issues/457)) +* Documentation Fix for `github_actions_public_key` data-source ([#458](https://github.com/integrations/terraform-provider-github/issues/458)) +* Documentation Fix for `github_branch_protection` resource ([#410](https://github.com/integrations/terraform-provider-github/issues/410)) +* Documentation Layout Fix for `github_ip_ranges` and `github_membership` data sources ([#423](https://github.com/integrations/terraform-provider-github/issues/423)) +* Documentation Fix for `github_repository_file` import ([#443](https://github.com/integrations/terraform-provider-github/issues/443)) +* Update `go-github` to `v31.0.0` ([#424](https://github.com/integrations/terraform-provider-github/issues/424)) ENHANCEMENTS: -* **New Data Source** `github_organization_team_sync_groups` ([#400](https://github.com/terraform-providers/terraform-provider-github/issues/400)) -* **New Resource** `github_team_sync_group_mapping` ([#400](https://github.com/terraform-providers/terraform-provider-github/issues/400)) +* **New Data Source** `github_organization_team_sync_groups` ([#400](https://github.com/integrations/terraform-provider-github/issues/400)) +* **New Resource** `github_team_sync_group_mapping` ([#400](https://github.com/integrations/terraform-provider-github/issues/400)) ## 2.7.0 (May 01, 2020) BUG FIXES: -* Add Missing Acceptance Test ([#427](https://github.com/terraform-providers/terraform-provider-github/issues/427)) +* Add Missing Acceptance Test ([#427](https://github.com/integrations/terraform-provider-github/issues/427)) ENHANCEMENTS: -* Add GraphQL Client ([#331](https://github.com/terraform-providers/terraform-provider-github/issues/331)) -* **New Data Source** `github_branch` ([#364](https://github.com/terraform-providers/terraform-provider-github/issues/364)) -* **New Resource** `github_branch` ([#364](https://github.com/terraform-providers/terraform-provider-github/issues/364)) +* Add GraphQL Client ([#331](https://github.com/integrations/terraform-provider-github/issues/331)) +* **New Data Source** `github_branch` ([#364](https://github.com/integrations/terraform-provider-github/issues/364)) +* **New Resource** `github_branch` ([#364](https://github.com/integrations/terraform-provider-github/issues/364)) ## 2.6.1 (April 07, 2020) BUG FIXES: -* Documentation Fix For Option To Manage `Delete Branch on Merge` ([#408](https://github.com/terraform-providers/terraform-provider-github/issues/408)) -* Documentation Fix For `github_actions_secret` / `github_actions_public_key` ([#413](https://github.com/terraform-providers/terraform-provider-github/issues/413)) +* Documentation Fix For Option To Manage `Delete Branch on Merge` ([#408](https://github.com/integrations/terraform-provider-github/issues/408)) +* Documentation Fix For `github_actions_secret` / `github_actions_public_key` ([#413](https://github.com/integrations/terraform-provider-github/issues/413)) ## 2.6.0 (April 03, 2020) ENHANCEMENTS: -* resource/github_repository: Introduce Option To Manage `Delete Branch on Merge` ([#399](https://github.com/terraform-providers/terraform-provider-github/issues/399)) -* resource/github_repository: Configure Repository As Template ([#357](https://github.com/terraform-providers/terraform-provider-github/issues/357)) -* **New Data Source** `github_membership` ([#396](https://github.com/terraform-providers/terraform-provider-github/issues/396)) +* resource/github_repository: Introduce Option To Manage `Delete Branch on Merge` ([#399](https://github.com/integrations/terraform-provider-github/issues/399)) +* resource/github_repository: Configure Repository As Template ([#357](https://github.com/integrations/terraform-provider-github/issues/357)) +* **New Data Source** `github_membership` ([#396](https://github.com/integrations/terraform-provider-github/issues/396)) ## 2.5.1 (April 02, 2020) BUG FIXES: -* Fix Broken Link For `github_actions_secret` Documentation ([#405](https://github.com/terraform-providers/terraform-provider-github/issues/405)) +* Fix Broken Link For `github_actions_secret` Documentation ([#405](https://github.com/integrations/terraform-provider-github/issues/405)) ## 2.5.0 (March 30, 2020) REGRESSION: -* `go-github` `v29.03` is incompatible with versions of GitHub Enterprise Server prior to `v2.21.5`. ([[#404](https://github.com/terraform-providers/terraform-provider-github/issues/404)]) +* `go-github` `v29.03` is incompatible with versions of GitHub Enterprise Server prior to `v2.21.5`. ([[#404](https://github.com/integrations/terraform-provider-github/issues/404)]) ENHANCEMENTS: * Add `apps` To `github_branch_protection` Restrictions -* **New Data Source** `github_actions_public_key` ([[#362](https://github.com/terraform-providers/terraform-provider-github/issues/362)]) -* **New Data Source** `github_actions_secrets` ([[#362](https://github.com/terraform-providers/terraform-provider-github/issues/362)]) -* **New Resource:** `github_actions_secret` ([[#362](https://github.com/terraform-providers/terraform-provider-github/issues/362)]) +* **New Data Source** `github_actions_public_key` ([[#362](https://github.com/integrations/terraform-provider-github/issues/362)]) +* **New Data Source** `github_actions_secrets` ([[#362](https://github.com/integrations/terraform-provider-github/issues/362)]) +* **New Resource:** `github_actions_secret` ([[#362](https://github.com/integrations/terraform-provider-github/issues/362)]) BUG FIXES: -* Prevent Panic From DismissalRestrictions ([[#385](https://github.com/terraform-providers/terraform-provider-github/issues/385)]) -* Update `go-github` to `v29.0.3` ([[#369](https://github.com/terraform-providers/terraform-provider-github/issues/369)]) -* Update `go` to `1.13` ([[#372](https://github.com/terraform-providers/terraform-provider-github/issues/372)]) +* Prevent Panic From DismissalRestrictions ([[#385](https://github.com/integrations/terraform-provider-github/issues/385)]) +* Update `go-github` to `v29.0.3` ([[#369](https://github.com/integrations/terraform-provider-github/issues/369)]) +* Update `go` to `1.13` ([[#372](https://github.com/integrations/terraform-provider-github/issues/372)]) * Documentation Fixes For Consistency And Typography @@ -225,181 +225,181 @@ BUG FIXES: BUG FIXES: -* Updates `go-github` to `v29` to unblock planned feature development ([#342](https://github.com/terraform-providers/terraform-provider-github/issues/342)) -* Fixes `insecure_ssl` parameter behaviour for `github_organization_webhook` and `github_repository_webhook` ([#365](https://github.com/terraform-providers/terraform-provider-github/issues/365)) -* Fixes label behaviour to not create new labels when renaming a `github_issue_label` ([#288](https://github.com/terraform-providers/terraform-provider-github/issues/288)) +* Updates `go-github` to `v29` to unblock planned feature development ([#342](https://github.com/integrations/terraform-provider-github/issues/342)) +* Fixes `insecure_ssl` parameter behaviour for `github_organization_webhook` and `github_repository_webhook` ([#365](https://github.com/integrations/terraform-provider-github/issues/365)) +* Fixes label behaviour to not create new labels when renaming a `github_issue_label` ([#288](https://github.com/integrations/terraform-provider-github/issues/288)) ## 2.4.0 (February 26, 2020) ENHANCEMENTS: -* **New Data Source** `github_release` ([#356](https://github.com/terraform-providers/terraform-provider-github/pull/356)) +* **New Data Source** `github_release` ([#356](https://github.com/integrations/terraform-provider-github/pull/356)) -* **New Resource:** `github_repository_file` ([#318](https://github.com/terraform-providers/terraform-provider-github/pull/318)) +* **New Resource:** `github_repository_file` ([#318](https://github.com/integrations/terraform-provider-github/pull/318)) ## 2.3.2 (February 05, 2020) BUG FIXES: -* Handle repository 404 for `github_repository_collaborator` resource ([#348](https://github.com/terraform-providers/terraform-provider-github/issues/348)) +* Handle repository 404 for `github_repository_collaborator` resource ([#348](https://github.com/integrations/terraform-provider-github/issues/348)) ## 2.3.1 (January 27, 2020) BUG FIXES: -* Add support for `triage` and `maintain` permissions in some resources ([#303](https://github.com/terraform-providers/terraform-provider-github/issues/303)) +* Add support for `triage` and `maintain` permissions in some resources ([#303](https://github.com/integrations/terraform-provider-github/issues/303)) ## 2.3.0 (January 22, 2020) BUG FIXES: -* `resource/resource_github_team_membership`: Prevent spurious diffs caused by upstream API change made on 17th January ([#325](https://github.com/terraform-providers/terraform-provider-github/issues/325)) +* `resource/resource_github_team_membership`: Prevent spurious diffs caused by upstream API change made on 17th January ([#325](https://github.com/integrations/terraform-provider-github/issues/325)) ENHANCEMENTS: -* `resource/repository`: Added functionality to generate a new repository from a Template Repository ([#309](https://github.com/terraform-providers/terraform-provider-github/issues/309)) +* `resource/repository`: Added functionality to generate a new repository from a Template Repository ([#309](https://github.com/integrations/terraform-provider-github/issues/309)) ## 2.2.1 (September 04, 2019) ENHANCEMENTS: -* dependencies: Updated module `hashicorp/terraform` to `v0.12.7` ([#273](https://github.com/terraform-providers/terraform-provider-github/issues/273)) -* `resource/github_branch_protection`: Will now return an error when users are not correctly added ([#158](https://github.com/terraform-providers/terraform-provider-github/issues/158)) -* `provider`: Added optional `anonymous` attribute, and made `token` optional ([#255](https://github.com/terraform-providers/terraform-provider-github/issues/255)) +* dependencies: Updated module `hashicorp/terraform` to `v0.12.7` ([#273](https://github.com/integrations/terraform-provider-github/issues/273)) +* `resource/github_branch_protection`: Will now return an error when users are not correctly added ([#158](https://github.com/integrations/terraform-provider-github/issues/158)) +* `provider`: Added optional `anonymous` attribute, and made `token` optional ([#255](https://github.com/integrations/terraform-provider-github/issues/255)) BUG FIXES: -* `resource/github_repository`: Allow setting `default_branch` to `master` on creation ([#150](https://github.com/terraform-providers/terraform-provider-github/issues/150)) -* `resource/github_team_repository`: Validation of `team_id` ([#253](https://github.com/terraform-providers/terraform-provider-github/issues/253)) -* `resource/github_team_membership`: Validation of `team_id` ([#253](https://github.com/terraform-providers/terraform-provider-github/issues/253)) -* `resource/github_organization_webhook`: Properly set webhook secret in state ([#251](https://github.com/terraform-providers/terraform-provider-github/issues/251)) -* `resource/github_repository_webhook`: Properly set webhook secret in state ([#251](https://github.com/terraform-providers/terraform-provider-github/issues/251)) +* `resource/github_repository`: Allow setting `default_branch` to `master` on creation ([#150](https://github.com/integrations/terraform-provider-github/issues/150)) +* `resource/github_team_repository`: Validation of `team_id` ([#253](https://github.com/integrations/terraform-provider-github/issues/253)) +* `resource/github_team_membership`: Validation of `team_id` ([#253](https://github.com/integrations/terraform-provider-github/issues/253)) +* `resource/github_organization_webhook`: Properly set webhook secret in state ([#251](https://github.com/integrations/terraform-provider-github/issues/251)) +* `resource/github_repository_webhook`: Properly set webhook secret in state ([#251](https://github.com/integrations/terraform-provider-github/issues/251)) ## 2.2.0 (June 28, 2019) FEATURES: -* **New Data Source** `github_collaborators` ([#239](https://github.com/terraform-providers/terraform-provider-github/issues/239)) +* **New Data Source** `github_collaborators` ([#239](https://github.com/integrations/terraform-provider-github/issues/239)) ENHANCEMENTS: -* `provider`: Added optional `individual` attribute, and made `organization` optional ([#242](https://github.com/terraform-providers/terraform-provider-github/issues/242)) -* `resource/github_branch_protection`: Added `require_signed_commits` property ([#214](https://github.com/terraform-providers/terraform-provider-github/issues/214)) +* `provider`: Added optional `individual` attribute, and made `organization` optional ([#242](https://github.com/integrations/terraform-provider-github/issues/242)) +* `resource/github_branch_protection`: Added `require_signed_commits` property ([#214](https://github.com/integrations/terraform-provider-github/issues/214)) BUG FIXES: -* `resource/github_membership`: `username` property is now case insensitive ([#241](https://github.com/terraform-providers/terraform-provider-github/issues/241)) -* `resource/github_repository`: `has_projects` can now be imported ([#237](https://github.com/terraform-providers/terraform-provider-github/issues/237)) -* `resource/github_repository_collaborator`: `username` property is now case insensitive [[#241](https://github.com/terraform-providers/terraform-provider-github/issues/241)) -* `resource/github_team_membership`: `username` property is now case insensitive ([#241](https://github.com/terraform-providers/terraform-provider-github/issues/241)) +* `resource/github_membership`: `username` property is now case insensitive ([#241](https://github.com/integrations/terraform-provider-github/issues/241)) +* `resource/github_repository`: `has_projects` can now be imported ([#237](https://github.com/integrations/terraform-provider-github/issues/237)) +* `resource/github_repository_collaborator`: `username` property is now case insensitive [[#241](https://github.com/integrations/terraform-provider-github/issues/241)) +* `resource/github_team_membership`: `username` property is now case insensitive ([#241](https://github.com/integrations/terraform-provider-github/issues/241)) ## 2.1.0 (May 15, 2019) ENHANCEMENTS: -* `resource/github_repository`: Added validation for lowercase topics ([#223](https://github.com/terraform-providers/terraform-provider-github/issues/223)) -* `resource/github_organization_webhook`: Added back removed `name` attribute, `name` is now flagged as `Removed` ([#226](https://github.com/terraform-providers/terraform-provider-github/issues/226)) -* `resource/github_repository_webhook`: Added back removed `name` attribute, `name` is now flagged as `Removed` ([#226](https://github.com/terraform-providers/terraform-provider-github/issues/226)) +* `resource/github_repository`: Added validation for lowercase topics ([#223](https://github.com/integrations/terraform-provider-github/issues/223)) +* `resource/github_organization_webhook`: Added back removed `name` attribute, `name` is now flagged as `Removed` ([#226](https://github.com/integrations/terraform-provider-github/issues/226)) +* `resource/github_repository_webhook`: Added back removed `name` attribute, `name` is now flagged as `Removed` ([#226](https://github.com/integrations/terraform-provider-github/issues/226)) ## 2.0.0 (May 02, 2019) -* This release adds support for Terraform 0.12 ([#181](https://github.com/terraform-providers/terraform-provider-github/issues/181)) +* This release adds support for Terraform 0.12 ([#181](https://github.com/integrations/terraform-provider-github/issues/181)) BREAKING CHANGES: -* `resource/github_repository_webhook`: Removed `name` attribute ([#181](https://github.com/terraform-providers/terraform-provider-github/issues/181)) -* `resource/github_organization_webhook`: Removed `name` attribute ([#181](https://github.com/terraform-providers/terraform-provider-github/issues/181)) +* `resource/github_repository_webhook`: Removed `name` attribute ([#181](https://github.com/integrations/terraform-provider-github/issues/181)) +* `resource/github_organization_webhook`: Removed `name` attribute ([#181](https://github.com/integrations/terraform-provider-github/issues/181)) FEATURES: -* **New Resource:** `github_organization_block` ([#181](https://github.com/terraform-providers/terraform-provider-github/issues/181)) -* **New Resource:** `github_user_invitation_accepter` ([#161](https://github.com/terraform-providers/terraform-provider-github/issues/161)) -* `resource/github_branch_protection`: Added `required_approving_review_count` property ([#181](https://github.com/terraform-providers/terraform-provider-github/issues/181)) +* **New Resource:** `github_organization_block` ([#181](https://github.com/integrations/terraform-provider-github/issues/181)) +* **New Resource:** `github_user_invitation_accepter` ([#161](https://github.com/integrations/terraform-provider-github/issues/161)) +* `resource/github_branch_protection`: Added `required_approving_review_count` property ([#181](https://github.com/integrations/terraform-provider-github/issues/181)) BUG FIXES: -* `resource/github_repository`: Prefill `auto_init` during import ([#154](https://github.com/terraform-providers/terraform-provider-github/issues/154)) +* `resource/github_repository`: Prefill `auto_init` during import ([#154](https://github.com/integrations/terraform-provider-github/issues/154)) ## 1.3.0 (September 07, 2018) FEATURES: -* **New Resource:** `github_project_column` ([#139](https://github.com/terraform-providers/terraform-provider-github/issues/139)) +* **New Resource:** `github_project_column` ([#139](https://github.com/integrations/terraform-provider-github/issues/139)) ENHANCEMENTS: -* _all resources_: Use `Etag` to save API quota (~ 33%) ([#143](https://github.com/terraform-providers/terraform-provider-github/issues/143)) -* _all resources_: Implement & use RateLimitTransport to avoid hitting API rate limits ([#145](https://github.com/terraform-providers/terraform-provider-github/issues/145)) +* _all resources_: Use `Etag` to save API quota (~ 33%) ([#143](https://github.com/integrations/terraform-provider-github/issues/143)) +* _all resources_: Implement & use RateLimitTransport to avoid hitting API rate limits ([#145](https://github.com/integrations/terraform-provider-github/issues/145)) BUG FIXES: -* `resource/github_issue_label`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/terraform-providers/terraform-provider-github/issues/142)) -* `resource/github_membership`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/terraform-providers/terraform-provider-github/issues/142)) -* `resource/github_repository_deploy_key`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/terraform-providers/terraform-provider-github/issues/142)) -* `resource/github_team`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/terraform-providers/terraform-provider-github/issues/142)) -* `resource/github_team_membership`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/terraform-providers/terraform-provider-github/issues/142)) -* `resource/github_team_repository`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/terraform-providers/terraform-provider-github/issues/142)) -* `resource/github_user_gpg_key`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/terraform-providers/terraform-provider-github/issues/142)) +* `resource/github_issue_label`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) +* `resource/github_membership`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) +* `resource/github_repository_deploy_key`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) +* `resource/github_team`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) +* `resource/github_team_membership`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) +* `resource/github_team_repository`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) +* `resource/github_user_gpg_key`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) ## 1.2.1 (August 17, 2018) BUG FIXES: -* `resource/github_repository`: Avoid spurious diff for `topics` ([#138](https://github.com/terraform-providers/terraform-provider-github/issues/138)) +* `resource/github_repository`: Avoid spurious diff for `topics` ([#138](https://github.com/integrations/terraform-provider-github/issues/138)) ## 1.2.0 (August 17, 2018) FEATURES: -* **New Data Source:** `github_repository` ([#109](https://github.com/terraform-providers/terraform-provider-github/issues/109)) -* **New Data Source:** `github_repositories` ([#129](https://github.com/terraform-providers/terraform-provider-github/issues/129)) -* **New Resource:** `github_organization_project` ([#111](https://github.com/terraform-providers/terraform-provider-github/issues/111)) -* **New Resource:** `github_repository_project` ([#115](https://github.com/terraform-providers/terraform-provider-github/issues/115)) -* **New Resource:** `github_user_gpg_key` ([#120](https://github.com/terraform-providers/terraform-provider-github/issues/120)) -* **New Resource:** `github_user_ssh_key` ([#119](https://github.com/terraform-providers/terraform-provider-github/issues/119)) +* **New Data Source:** `github_repository` ([#109](https://github.com/integrations/terraform-provider-github/issues/109)) +* **New Data Source:** `github_repositories` ([#129](https://github.com/integrations/terraform-provider-github/issues/129)) +* **New Resource:** `github_organization_project` ([#111](https://github.com/integrations/terraform-provider-github/issues/111)) +* **New Resource:** `github_repository_project` ([#115](https://github.com/integrations/terraform-provider-github/issues/115)) +* **New Resource:** `github_user_gpg_key` ([#120](https://github.com/integrations/terraform-provider-github/issues/120)) +* **New Resource:** `github_user_ssh_key` ([#119](https://github.com/integrations/terraform-provider-github/issues/119)) ENHANCEMENTS: -* `provider`: Add `insecure` mode ([#48](https://github.com/terraform-providers/terraform-provider-github/issues/48)) -* `data-source/github_ip_ranges`: Add importer IPs ([#100](https://github.com/terraform-providers/terraform-provider-github/issues/100)) -* `resource/github_issue_label`: Add support for `description` ([#118](https://github.com/terraform-providers/terraform-provider-github/issues/118)) -* `resource/github_repository`: Add support for `topics` ([#97](https://github.com/terraform-providers/terraform-provider-github/issues/97)) -* `resource/github_team`: Expose `slug` ([#136](https://github.com/terraform-providers/terraform-provider-github/issues/136)) -* `resource/github_team_membership`: Make role updatable ([#137](https://github.com/terraform-providers/terraform-provider-github/issues/137)) +* `provider`: Add `insecure` mode ([#48](https://github.com/integrations/terraform-provider-github/issues/48)) +* `data-source/github_ip_ranges`: Add importer IPs ([#100](https://github.com/integrations/terraform-provider-github/issues/100)) +* `resource/github_issue_label`: Add support for `description` ([#118](https://github.com/integrations/terraform-provider-github/issues/118)) +* `resource/github_repository`: Add support for `topics` ([#97](https://github.com/integrations/terraform-provider-github/issues/97)) +* `resource/github_team`: Expose `slug` ([#136](https://github.com/integrations/terraform-provider-github/issues/136)) +* `resource/github_team_membership`: Make role updatable ([#137](https://github.com/integrations/terraform-provider-github/issues/137)) BUG FIXES: -* `resource/github_*`: Prevent crashing on invalid ID format ([#108](https://github.com/terraform-providers/terraform-provider-github/issues/108)) -* `resource/github_organization_webhook`: Avoid spurious diff of `secret` ([#134](https://github.com/terraform-providers/terraform-provider-github/issues/134)) -* `resource/github_repository`: Make non-updatable fields `ForceNew` ([#135](https://github.com/terraform-providers/terraform-provider-github/issues/135)) -* `resource/github_repository_deploy_key`: Avoid spurious diff of `key` ([#132](https://github.com/terraform-providers/terraform-provider-github/issues/132)) -* `resource/github_repository_webhook`: Avoid spurious diff of `secret` ([#133](https://github.com/terraform-providers/terraform-provider-github/issues/133)) +* `resource/github_*`: Prevent crashing on invalid ID format ([#108](https://github.com/integrations/terraform-provider-github/issues/108)) +* `resource/github_organization_webhook`: Avoid spurious diff of `secret` ([#134](https://github.com/integrations/terraform-provider-github/issues/134)) +* `resource/github_repository`: Make non-updatable fields `ForceNew` ([#135](https://github.com/integrations/terraform-provider-github/issues/135)) +* `resource/github_repository_deploy_key`: Avoid spurious diff of `key` ([#132](https://github.com/integrations/terraform-provider-github/issues/132)) +* `resource/github_repository_webhook`: Avoid spurious diff of `secret` ([#133](https://github.com/integrations/terraform-provider-github/issues/133)) ## 1.1.0 (May 11, 2018) FEATURES: -* **New Data Source:** `github_ip_ranges` ([#82](https://github.com/terraform-providers/terraform-provider-github/issues/82)) +* **New Data Source:** `github_ip_ranges` ([#82](https://github.com/integrations/terraform-provider-github/issues/82)) ENHANCEMENTS: -* `resource/github_repository`: Add support for archiving ([#64](https://github.com/terraform-providers/terraform-provider-github/issues/64)) -* `resource/github_repository`: Add `html_url` ([#93](https://github.com/terraform-providers/terraform-provider-github/issues/93)) -* `resource/github_repository`: Add `has_projects` ([#92](https://github.com/terraform-providers/terraform-provider-github/issues/92)) -* `resource/github_team`: Add `parent_team_id` ([#54](https://github.com/terraform-providers/terraform-provider-github/issues/54)) +* `resource/github_repository`: Add support for archiving ([#64](https://github.com/integrations/terraform-provider-github/issues/64)) +* `resource/github_repository`: Add `html_url` ([#93](https://github.com/integrations/terraform-provider-github/issues/93)) +* `resource/github_repository`: Add `has_projects` ([#92](https://github.com/integrations/terraform-provider-github/issues/92)) +* `resource/github_team`: Add `parent_team_id` ([#54](https://github.com/integrations/terraform-provider-github/issues/54)) ## 1.0.0 (February 20, 2018) ENHANCEMENTS: -* `resource/github_branch_protection`: Add support for `require_code_owners_review` ([#51](https://github.com/terraform-providers/terraform-provider-github/issues/51)) +* `resource/github_branch_protection`: Add support for `require_code_owners_review` ([#51](https://github.com/integrations/terraform-provider-github/issues/51)) ## 0.1.2 (February 12, 2018) BUG FIXES: -* `resource/github_membership`: Fix a crash when bad import input is given ([#72](https://github.com/terraform-providers/terraform-provider-github/issues/72)) +* `resource/github_membership`: Fix a crash when bad import input is given ([#72](https://github.com/integrations/terraform-provider-github/issues/72)) ## 0.1.1 (July 18, 2017) @@ -409,23 +409,23 @@ BACKWARDS INCOMPATIBILITIES / NOTES: IMPROVEMENTS: -* `resource/github_repository`: Allow updating default_branch ([#23](https://github.com/terraform-providers/terraform-provider-github/issues/23)) -* `resource/github_repository`: Add license_template and gitignore_template ([#24](https://github.com/terraform-providers/terraform-provider-github/issues/24)) -* `resource/github_repository_webhook`: Add import ([#29](https://github.com/terraform-providers/terraform-provider-github/issues/29)) -* `resource/github_branch_protection`: Support enforce_admins ([#26](https://github.com/terraform-providers/terraform-provider-github/issues/26)) -* `resource/github_team`: Supports managing a team's LDAP DN in GitHub Enterprise ([#39](https://github.com/terraform-providers/terraform-provider-github/issues/39)) +* `resource/github_repository`: Allow updating default_branch ([#23](https://github.com/integrations/terraform-provider-github/issues/23)) +* `resource/github_repository`: Add license_template and gitignore_template ([#24](https://github.com/integrations/terraform-provider-github/issues/24)) +* `resource/github_repository_webhook`: Add import ([#29](https://github.com/integrations/terraform-provider-github/issues/29)) +* `resource/github_branch_protection`: Support enforce_admins ([#26](https://github.com/integrations/terraform-provider-github/issues/26)) +* `resource/github_team`: Supports managing a team's LDAP DN in GitHub Enterprise ([#39](https://github.com/integrations/terraform-provider-github/issues/39)) BUG FIXES: -* `resource/github_branch_protection`: Fix crash on nil values ([#26](https://github.com/terraform-providers/terraform-provider-github/issues/26)) +* `resource/github_branch_protection`: Fix crash on nil values ([#26](https://github.com/integrations/terraform-provider-github/issues/26)) ## 0.1.0 (June 20, 2017) FEATURES: -* **New Resource:** `github_repository_deploy_key` [[#15215](https://github.com/terraform-providers/terraform-provider-github/issues/15215)](https://github.com/hashicorp/terraform/pull/15215) +* **New Resource:** `github_repository_deploy_key` [[#15215](https://github.com/integrations/terraform-provider-github/issues/15215)](https://github.com/hashicorp/terraform/pull/15215) IMPROVEMENTS: -* `resource/github_repository`: Adding merge types ([#1](https://github.com/terraform-providers/terraform-provider-github/issues/1)) -* `data-source/github_user` and `data-source/github_team`: Added attributes ([#2](https://github.com/terraform-providers/terraform-provider-github/issues/2)) +* `resource/github_repository`: Adding merge types ([#1](https://github.com/integrations/terraform-provider-github/issues/1)) +* `data-source/github_user` and `data-source/github_team`: Added attributes ([#2](https://github.com/integrations/terraform-provider-github/issues/2)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 78e2542a54..cb1f26fd2d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,7 +35,7 @@ In line with Terraform Provider testing best practices, these tests exercise aga Clone the provider ```sh -$ git clone git@github.com:terraform-providers/terraform-provider-github.git +$ git clone git@github.com:integrations/terraform-provider-github.git ``` Enter the provider directory and build the provider diff --git a/examples/README.md b/examples/README.md index 38a9a050f7..36e59a9c45 100644 --- a/examples/README.md +++ b/examples/README.md @@ -10,7 +10,7 @@ the example's own directory. For example: ``` -$ git clone https://github.com/terraform-providers/terraform-provider-github +$ git clone https://github.com/integrations/terraform-provider-github $ cd terraform-provider-github/examples/repository_collaborator $ terraform init $ terraform plan diff --git a/github/resource_github_repository_test.go b/github/resource_github_repository_test.go index 1793a9c6f6..0deac806a6 100644 --- a/github/resource_github_repository_test.go +++ b/github/resource_github_repository_test.go @@ -247,7 +247,7 @@ func TestAccGithubRepositories(t *testing.T) { "main", ), ), - // FIXME: Deferred until https://github.com/terraform-providers/terraform-provider-github/issues/513 + // FIXME: Deferred until https://github.com/integrations/terraform-provider-github/issues/513 // > Cannot update default branch for an empty repository. Please init the repository and push first // "after": resource.ComposeTestCheckFunc( // resource.TestCheckResourceAttr( diff --git a/github/resource_github_team_membership.go b/github/resource_github_team_membership.go index 86ac720256..190c065408 100644 --- a/github/resource_github_team_membership.go +++ b/github/resource_github_team_membership.go @@ -95,7 +95,7 @@ func resourceGithubTeamMembershipRead(d *schema.ResourceData, meta interface{}) // We intentionally set these early to allow reconciliation // from an upstream bug which emptied team_id in state - // See https://github.com/terraform-providers/terraform-provider-github/issues/323 + // See https://github.com/integrations/terraform-provider-github/issues/323 d.Set("team_id", teamIdString) d.Set("username", username) From ad5dffb1c74d6c29edf931d1bcc04fdbabd93629 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Wed, 27 Jan 2021 18:24:41 -0500 Subject: [PATCH 30/45] Add Example For `github_team_repository` (#676) * Add Example For `github_team_repository` also documents a limitation with `for_each` in this scenario * fixup! add newline --- examples/repository_team/README.md | 18 ++++++++++++ examples/repository_team/main.tf | 41 +++++++++++++++++++++++++++ examples/repository_team/outputs.tf | 0 examples/repository_team/providers.tf | 4 +++ examples/repository_team/variables.tf | 9 ++++++ 5 files changed, 72 insertions(+) create mode 100644 examples/repository_team/README.md create mode 100644 examples/repository_team/main.tf create mode 100644 examples/repository_team/outputs.tf create mode 100644 examples/repository_team/providers.tf create mode 100644 examples/repository_team/variables.tf diff --git a/examples/repository_team/README.md b/examples/repository_team/README.md new file mode 100644 index 0000000000..e81708d4bb --- /dev/null +++ b/examples/repository_team/README.md @@ -0,0 +1,18 @@ +# Repository Team Example + +This demos populating a repository with a team. + +This example will create a repositories in the specified `owner` organization. See https://www.terraform.io/docs/providers/github/index.html for details on configuring [`providers.tf`](./providers.tf) accordingly. + +Alternatively, you may use variables passed via command line: + +```console +export GITHUB_OWNER= +export GITHUB_TOKEN= +``` + +```console +terraform apply \ + -var "owner=${GITHUB_OWNER}" \ + -var "github_token=${GITHUB_TOKEN}" +``` diff --git a/examples/repository_team/main.tf b/examples/repository_team/main.tf new file mode 100644 index 0000000000..dfbe6d8d42 --- /dev/null +++ b/examples/repository_team/main.tf @@ -0,0 +1,41 @@ +# NOTE: There are errors when using the following syntax. See links for details. +# /cc https://github.com/hashicorp/terraform/issues/23529 +# /cc https://github.com/hashicorp/terraform/issues/4149 +# /cc https://github.com/integrations/terraform-provider-github/issues/500 +# +# data "github_team" "writers" { +# slug = "writer-team" +# } +# +# resource "github_team_repository" "writers" { +# for_each = data.github_team.writers.id +# # or for multiple teams something like: +# # for_each = { for obj in [data.github_team.writers] : obj.id => obj.id } +# team_id = each.value +# repository = "repo" +# permission = "push" +# } + +data "github_team" "writers" { + slug = "writers" +} + +data "github_team" "editors" { + slug = "editors" +} + +locals { + teams = [data.github_team.writers.id, data.github_team.editors.id] +} + +resource "github_repository" "writers" { + name = "writers" + auto_init = true +} + +resource "github_team_repository" "writers" { + count = length(local.teams) + team_id = local.teams[count.index] + repository = github_repository.writers.name + permission = "push" +} diff --git a/examples/repository_team/outputs.tf b/examples/repository_team/outputs.tf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/repository_team/providers.tf b/examples/repository_team/providers.tf new file mode 100644 index 0000000000..07836b6b1a --- /dev/null +++ b/examples/repository_team/providers.tf @@ -0,0 +1,4 @@ +provider "github" { + owner = var.owner + token = var.github_token +} diff --git a/examples/repository_team/variables.tf b/examples/repository_team/variables.tf new file mode 100644 index 0000000000..aafb16bf9f --- /dev/null +++ b/examples/repository_team/variables.tf @@ -0,0 +1,9 @@ +variable "owner" { + description = "GitHub owner used to configure the provider" + type = string +} + +variable "github_token" { + description = "GitHub access token used to configure the provider" + type = string +} From ad27808f1a38837abe23527548847a159aa882ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20H=C3=B6ltje?= Date: Thu, 28 Jan 2021 20:42:51 -0500 Subject: [PATCH 31/45] changelog: manually fix links to issues (#673) They were pointing to the old archived repo, which doesn't have newer issues. From ced560d6bdd02e3bfa3f26b48647058467811af1 Mon Sep 17 00:00:00 2001 From: Kevin Zhao Date: Tue, 2 Feb 2021 07:03:20 -0800 Subject: [PATCH 32/45] Handle base64 decodable repo names (#684) --- github/util_v4_repository.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/github/util_v4_repository.go b/github/util_v4_repository.go index 66a1be4043..2868a01523 100644 --- a/github/util_v4_repository.go +++ b/github/util_v4_repository.go @@ -3,22 +3,20 @@ package github import ( "context" "encoding/base64" + "errors" "github.com/shurcooL/githubv4" ) func getRepositoryID(name string, meta interface{}) (githubv4.ID, error) { - // Interperet `name` as a node ID and return - exists, err := repositoryNodeIDExists(name, meta) + // Interpret `name` as a node ID + exists, nodeIDerr := repositoryNodeIDExists(name, meta) if exists { return githubv4.ID(name), nil } - if err != nil { - return nil, err - } - // Resolve `name` to a node ID and return + // Could not find repo by node ID, interpret `name` as repo name var query struct { Repository struct { ID githubv4.ID @@ -30,9 +28,13 @@ func getRepositoryID(name string, meta interface{}) (githubv4.ID, error) { } ctx := context.Background() client := meta.(*Owner).v4client - err = client.Query(ctx, &query, variables) - if err != nil { - return nil, err + nameErr := client.Query(ctx, &query, variables) + if nameErr != nil { + if nodeIDerr != nil { + // Could not find repo by node ID or repo name, return both errors + return nil, errors.New(nodeIDerr.Error() + nameErr.Error()) + } + return nil, nameErr } return query.Repository.ID, nil From f6494669c5a5d0fac58d698986dda5fbdaaeda81 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 2 Feb 2021 15:03:43 +0000 Subject: [PATCH 33/45] github/config: Fix detection of individual, non-org accounts (#685) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Previously, whenever an individual user tried to interact with their repos, the provider would return an error, rendering v4.3.1 unusable _for individuals_: ``` ➜ terraform plan Error: GET https://api.github.com/orgs/issyl0: 404 Not Found [] on /Users/issyl0/repos/terraform/github.tf line 1, in provider "github": ``` - `ConfigureOwner` works such that if the `owner.name` is not blank (ie, the user had specified `owner = ` in their Terraform file), the code progresses to check if the `owner.name` is an org. Importantly, that check (prior to this change) returned an error if `owner.name` was not an org. That final error meant it was impossible to run if not using an organisation account. - Reproduction steps: https://gist.github.com/issyl0/cd61e4cb59de2c2e1e8f45e3cf7c12f5 --- github/config.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/github/config.go b/github/config.go index a7bc53694f..9e669aefa4 100644 --- a/github/config.go +++ b/github/config.go @@ -115,8 +115,6 @@ func (c *Config) ConfigureOwner(owner *Owner) (*Owner, error) { owner.id = remoteOrg.GetID() owner.IsOrganization = true } - } else { - return nil, err } } From c5eda7251b384fb6e53ae3afb7bbc4ccd4bdc74d Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Tue, 2 Feb 2021 10:14:08 -0500 Subject: [PATCH 34/45] add changelog entry for v4.3.2 --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3db647ea39..780810e268 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ +## 4.3.2 (February 2, 2021) + +BUG FIXES: + +* Improved detection of repository name for `github_branch_protection` ([#684](https://github.com/integrations/terraform-provider-github/issues/684)) +* Reverts error handling in provider configuration ([#685](https://github.com/integrations/terraform-provider-github/issues/685)) + ## 4.3.1 (January 22, 2021) +REGRESSIONS: + +- provider configuration breaks for individual accounts ([#678](https://github.com/integrations/terraform-provider-github/issues/678)) + BUG FIXES: * Send valid payload when editing a repository resource with `github_branch_default` ([#666](https://github.com/integrations/terraform-provider-github/issues/666)) From 3ab313b03fb8bcb5efec1b7cd8a4830156515061 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Fri, 5 Feb 2021 07:45:19 -0500 Subject: [PATCH 35/45] Add `create_default_maintainer` Option To `github_team` (#661) * Add `create_default_maintainer` option to `github_team` This adds a possible fix to the following issues by providing users with an option to remove the automatic addition of a default maintainer to a team during creation. /cc https://github.com/integrations/terraform-provider-github/pull/527 /cc https://github.com/integrations/terraform-provider-github/pull/104 /cc https://github.com/integrations/terraform-provider-github/pull/130 --- CHANGELOG.md | 7 + github/resource_github_team.go | 67 +++++- github/resource_github_team_test.go | 344 ++++++++++------------------ website/docs/r/team.html.markdown | 1 + 4 files changed, 190 insertions(+), 229 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 780810e268..16c248c3e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 4.4.0 (February 5, 2021) + +BUG FIXES: + +- Add `create_default_maintainer` option to `github_team` ([#527](https://github.com/integrations/terraform-provider-github/pull/527)), ([#104](https://github.com/integrations/terraform-provider-github/pull/104)), ([#130](https://github.com/integrations/terraform-provider-github/pull/130)) + + ## 4.3.2 (February 2, 2021) BUG FIXES: diff --git a/github/resource_github_team.go b/github/resource_github_team.go index 16d4db2098..d06a397adf 100644 --- a/github/resource_github_team.go +++ b/github/resource_github_team.go @@ -8,6 +8,7 @@ import ( "github.com/google/go-github/v32/github" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/shurcooL/githubv4" ) func resourceGithubTeam() *schema.Resource { @@ -43,6 +44,11 @@ func resourceGithubTeam() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "create_default_maintainer": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, "slug": { Type: schema.TypeString, Computed: true, @@ -55,6 +61,10 @@ func resourceGithubTeam() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "members_count": { + Type: schema.TypeInt, + Computed: true, + }, }, } } @@ -67,26 +77,36 @@ func resourceGithubTeamCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*Owner).v3client - orgName := meta.(*Owner).name + ownerName := meta.(*Owner).name name := d.Get("name").(string) + newTeam := github.NewTeam{ Name: name, Description: github.String(d.Get("description").(string)), Privacy: github.String(d.Get("privacy").(string)), } + if parentTeamID, ok := d.GetOk("parent_team_id"); ok { id := int64(parentTeamID.(int)) newTeam.ParentTeamID = &id } ctx := context.Background() - log.Printf("[DEBUG] Creating team: %s (%s)", name, orgName) + log.Printf("[DEBUG] Creating team: %s (%s)", name, ownerName) githubTeam, _, err := client.Teams.CreateTeam(ctx, - orgName, newTeam) + ownerName, newTeam) if err != nil { return err } + create_default_maintainer := d.Get("create_default_maintainer").(bool) + if !create_default_maintainer { + log.Printf("[DEBUG] Removing default maintainer from team: %s (%s)", name, ownerName) + if err := removeDefaultMaintainer(*githubTeam.Slug, meta); err != nil { + return err + } + } + if ldapDN := d.Get("ldap_dn").(string); ldapDN != "" { mapping := &github.TeamLDAPMapping{ LDAPDN: github.String(ldapDN), @@ -148,6 +168,7 @@ func resourceGithubTeamRead(d *schema.ResourceData, meta interface{}) error { d.Set("ldap_dn", team.GetLDAPDN()) d.Set("slug", team.GetSlug()) d.Set("node_id", team.GetNodeID()) + d.Set("members_count", team.GetMembersCount()) return nil } @@ -217,3 +238,43 @@ func resourceGithubTeamDelete(d *schema.ResourceData, meta interface{}) error { _, err = client.Teams.DeleteTeamByID(ctx, orgId, id) return err } + +func removeDefaultMaintainer(teamSlug string, meta interface{}) error { + + client := meta.(*Owner).v3client + orgName := meta.(*Owner).name + v4client := meta.(*Owner).v4client + + type User struct { + Login githubv4.String + } + + var query struct { + Organization struct { + Team struct { + Members struct { + Nodes []User + } + } `graphql:"team(slug:$slug)"` + } `graphql:"organization(login:$login)"` + } + variables := map[string]interface{}{ + "slug": githubv4.String(teamSlug), + "login": githubv4.String(orgName), + } + + err := v4client.Query(meta.(*Owner).StopContext, &query, variables) + if err != nil { + return err + } + + for _, user := range query.Organization.Team.Members.Nodes { + log.Printf("[DEBUG] Removing default maintainer from team: %s", user.Login) + _, err := client.Teams.RemoveTeamMembershipBySlug(meta.(*Owner).StopContext, orgName, teamSlug, string(user.Login)) + if err != nil { + return err + } + } + + return nil +} diff --git a/github/resource_github_team_test.go b/github/resource_github_team_test.go index 253a8e3a31..c6ccd203f1 100644 --- a/github/resource_github_team_test.go +++ b/github/resource_github_team_test.go @@ -1,261 +1,153 @@ package github import ( - "context" "fmt" - "strconv" "testing" - "github.com/google/go-github/v32/github" "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" ) -func TestAccGithubTeam_basic(t *testing.T) { - if err := testAccCheckOrganization(); err != nil { - t.Skipf("Skipping because %s.", err.Error()) - } - - var team github.Team - - rn := "github_team.foo" - randString := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) - name := fmt.Sprintf("tf-acc-test-%s", randString) - updatedName := fmt.Sprintf("tf-acc-test-updated-%s", randString) - description := "Terraform acc test group" - updatedDescription := "Terraform acc test group - updated" - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckGithubTeamDestroy, - Steps: []resource.TestStep{ - { - Config: testAccGithubTeamConfig(name), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubTeamExists(rn, &team), - testAccCheckGithubTeamAttributes(&team, name, description, nil), - resource.TestCheckResourceAttr(rn, "name", name), - resource.TestCheckResourceAttr(rn, "description", description), - resource.TestCheckResourceAttr(rn, "privacy", "secret"), - resource.TestCheckNoResourceAttr(rn, "parent_team_id"), - resource.TestCheckResourceAttr(rn, "ldap_dn", ""), - resource.TestCheckResourceAttr(rn, "slug", name), - ), - }, - { - Config: testAccGithubTeamUpdateConfig(randString), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubTeamExists(rn, &team), - testAccCheckGithubTeamAttributes(&team, updatedName, updatedDescription, nil), - resource.TestCheckResourceAttr(rn, "name", updatedName), - resource.TestCheckResourceAttr(rn, "description", updatedDescription), - resource.TestCheckResourceAttr(rn, "privacy", "closed"), - resource.TestCheckNoResourceAttr(rn, "parent_team_id"), - resource.TestCheckResourceAttr(rn, "ldap_dn", ""), - resource.TestCheckResourceAttr(rn, "slug", updatedName), - ), - }, - { - ResourceName: rn, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} +func TestAccGithubTeam(t *testing.T) { -func TestAccGithubTeam_slug(t *testing.T) { - if err := testAccCheckOrganization(); err != nil { - t.Skipf("Skipping because %s.", err.Error()) - } - - var team github.Team - - rn := "github_team.foo" - randString := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) - name := fmt.Sprintf("TF Acc Test %s", randString) - description := "Terraform acc test group" - expectedSlug := fmt.Sprintf("tf-acc-test-%s", randString) - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckGithubTeamDestroy, - Steps: []resource.TestStep{ - { - Config: testAccGithubTeamConfig(name), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubTeamExists(rn, &team), - testAccCheckGithubTeamAttributes(&team, name, description, nil), - resource.TestCheckResourceAttr(rn, "name", name), - resource.TestCheckResourceAttr(rn, "description", description), - resource.TestCheckResourceAttr(rn, "privacy", "secret"), - resource.TestCheckNoResourceAttr(rn, "parent_team_id"), - resource.TestCheckResourceAttr(rn, "ldap_dn", ""), - resource.TestCheckResourceAttr(rn, "slug", expectedSlug), - ), - }, - { - ResourceName: rn, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) -func TestAccGithubTeam_hierarchical(t *testing.T) { - if err := testAccCheckOrganization(); err != nil { - t.Skipf("Skipping because %s.", err.Error()) - } - - var parent, child github.Team - - rn := "github_team.parent" - randString := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) - parentName := fmt.Sprintf("tf-acc-parent-%s", randString) - childName := fmt.Sprintf("tf-acc-child-%s", randString) - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckGithubTeamDestroy, - Steps: []resource.TestStep{ - { - Config: testAccGithubTeamHierarchicalConfig(randString), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubTeamExists(rn, &parent), - testAccCheckGithubTeamAttributes(&parent, parentName, "Terraform acc test parent team", nil), - testAccCheckGithubTeamExists("github_team.child", &child), - testAccCheckGithubTeamAttributes(&child, childName, "Terraform acc test child team", &parent), - ), - }, - { - ResourceName: rn, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} + t.Run("creates a team configured with defaults", func(t *testing.T) { -func testAccCheckGithubTeamExists(n string, team *github.Team) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not Found: %s", n) + config := fmt.Sprintf(` + resource "github_team" "test" { + name = "tf-acc-%s" + } + `, randomID) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("github_team.test", "slug"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) } - if rs.Primary.ID == "" { - return fmt.Errorf("No Team ID is set") - } + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) - conn := testAccProvider.Meta().(*Owner).v3client - id, err := strconv.ParseInt(rs.Primary.ID, 10, 64) - if err != nil { - return unconvertibleIdErr(rs.Primary.ID, err) - } + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + }) - githubTeam, _, err := conn.Teams.GetTeamByID(context.TODO(), testAccProvider.Meta().(*Owner).id, id) - if err != nil { - return err - } - *team = *githubTeam - return nil - } } -func testAccCheckGithubTeamAttributes(team *github.Team, name, description string, parentTeam *github.Team) resource.TestCheckFunc { - return func(s *terraform.State) error { - if *team.Name != name { - return fmt.Errorf("Team name does not match: %s, %s", *team.Name, name) - } +func TestAccGithubTeamHierarchical(t *testing.T) { - if *team.Description != description { - return fmt.Errorf("Team description does not match: %s, %s", *team.Description, description) - } + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) - if parentTeam == nil && team.Parent != nil { - return fmt.Errorf("Team parent ID was expected to be empty, but was %d", team.Parent.GetID()) - } else if parentTeam != nil && team.Parent == nil { - return fmt.Errorf("Team parent ID was expected to be %d, but was not present", parentTeam.GetID()) - } else if parentTeam != nil && team.Parent.GetID() != parentTeam.GetID() { - return fmt.Errorf("Team parent ID does not match: %d, %d", team.Parent.GetID(), parentTeam.GetID()) + t.Run("creates a hierarchy of teams", func(t *testing.T) { + + config := fmt.Sprintf(` + resource "github_team" "parent" { + name = "tf-acc-parent-%s" + description = "Terraform acc test parent team" + privacy = "closed" + } + + resource "github_team" "child" { + name = "tf-acc-child-%[1]s" + description = "Terraform acc test child team" + privacy = "closed" + parent_team_id = "${github_team.parent.id}" + } + `, randomID) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("github_team.child", "parent_team_id"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) } - return nil - } -} + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) -func testAccCheckGithubTeamDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*Owner).v3client - orgId := testAccProvider.Meta().(*Owner).id + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) - for _, rs := range s.RootModule().Resources { - if rs.Type != "github_team" { - continue - } + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) - id, err := strconv.ParseInt(rs.Primary.ID, 10, 64) - if err != nil { - return unconvertibleIdErr(rs.Primary.ID, err) - } + }) - team, resp, err := conn.Teams.GetTeamByID(context.TODO(), orgId, id) - if err != nil { - if resp.StatusCode != 404 { - return err - } - } +} +func TestAccGithubTeamRemovesDefaultMaintainer(t *testing.T) { - var teamID string - if team != nil { - teamID = strconv.FormatInt(team.GetID(), 10) - } - if teamID == rs.Primary.ID { - return fmt.Errorf("Team still exists") + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) + + t.Run("creates a team and removes the default maintainer", func(t *testing.T) { + + config := fmt.Sprintf(` + resource "github_team" "test" { + name = "tf-acc-%s" + create_default_maintainer = false + } + `, randomID) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("github_team.test", "members_count", "0"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) } - return nil - } + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) - return nil -} + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) -func testAccGithubTeamConfig(teamName string) string { - return fmt.Sprintf(` -resource "github_team" "foo" { - name = "%s" - description = "Terraform acc test group" - privacy = "secret" -} -`, teamName) -} + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) -func testAccGithubTeamUpdateConfig(randString string) string { - return fmt.Sprintf(` -resource "github_team" "foo" { - name = "tf-acc-test-updated-%s" - description = "Terraform acc test group - updated" - privacy = "closed" -} -`, randString) -} + }) -func testAccGithubTeamHierarchicalConfig(randString string) string { - return fmt.Sprintf(` -resource "github_team" "parent" { - name = "tf-acc-parent-%s" - description = "Terraform acc test parent team" - privacy = "closed" -} -resource "github_team" "child" { - name = "tf-acc-child-%s" - description = "Terraform acc test child team" - privacy = "closed" - parent_team_id = "${github_team.parent.id}" -} -`, randString, randString) } diff --git a/website/docs/r/team.html.markdown b/website/docs/r/team.html.markdown index b903d86bd3..76c354bc0f 100644 --- a/website/docs/r/team.html.markdown +++ b/website/docs/r/team.html.markdown @@ -33,6 +33,7 @@ The following arguments are supported: Defaults to `secret`. * `parent_team_id` - (Optional) The ID of the parent team, if this is a nested team. * `ldap_dn` - (Optional) The LDAP Distinguished Name of the group where membership will be synchronized. Only available in GitHub Enterprise Server. +* `create_default_maintainer` - (Optional) Adds a default maintainer to the team. Defaults to `true` and removes the default maintaner when `false`. ## Attributes Reference From ddfb742939cdddad97e20eb0d6c52bfb252a8102 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Fri, 5 Feb 2021 07:46:51 -0500 Subject: [PATCH 36/45] Refresh CONTRIBUTING Documentation (#682) * refresh contributing docs * add quick instructions * add updates for newer versions of terraform --- CONTRIBUTING.md | 118 +++++++++++++++++++++++++++++++--------------- examples/dev.tfrc | 7 +++ 2 files changed, 87 insertions(+), 38 deletions(-) create mode 100644 examples/dev.tfrc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb1f26fd2d..3eed1ed28b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -## Contributing +# Contributing Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. @@ -22,14 +22,38 @@ Here are a few things you can do that will increase the likelihood of your pull - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). +## Quick End-To-End Example + +This section describes a typical sequence performed when developing locally. Full details of available tooling are available in the next section on [Automated And Manual Testing](#automated-and-manual-testing). + +1. Export necessary configuration for authenticating your provider with GitHub + ```sh + export GITHUB_TOKEN= + export GITHUB_ORGANIZATION= + ``` +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. +```sh +TF_LOG=DEBUG TF_ACC=1 go test -v ./... -run ^TestAccGithubIssueLabel +``` +1. Align the resource's implementation to your test case and observe it pass: +```sh +TF_ACC=1 go test -v ./... -run ^TestAccGithubIssueLabel +``` + +Note that some resources still use a previous format that is incompatible with automated test runs, which depend on using the `skipUnlessMode` helper. When encountering these resources, tests are rewritten to the latest format. + +Also note that there is no build / `terraform init` / `terraform plan` sequence here. It is uncommon to run into a bug or feature that requires iteration without using tests. When these cases arise, the `examples/` directory is used to approach the problem, which is detailed in the next section. + ## Automated And Manual Testing ### Overview -When raising a pull request against this project, automated tests will be launched to run our test suite. +When raising a pull request against this project, automated tests will be launched to run a subset of our test suite. -In line with Terraform Provider testing best practices, these tests exercise against a live, public GitHub deployment (referred to as `dotcom`). Tests may also run against an Enterprise GitHub deployment (referred to as `ghes`), which is sometimes available during parts of a month. If your change requires testing against a specific version of GitHub, please let a maintainer know and this may be arranged. +Full acceptance testing is run [daily][acc-daily]. In line with Terraform Provider testing best practices, these tests exercise against a live, public GitHub deployment (referred to as `dotcom`). Tests may also run against an Enterprise GitHub deployment (referred to as `ghes`), which is sometimes available during parts of a month. If your change requires testing against a specific version of GitHub, please let a maintainer know and this may be arranged. +Partial acceptance testing can be run manually by creating a branch prefixed with `test/`. Simple detection of changes and related test files is performed and a subset of acceptance tests are run against commits to these branches. This is a useful workflow for reviewing PRs submitted by the community, but local testing is preferred for contributors while iterating towards publishing a PR. ### Building The Provider @@ -38,18 +62,47 @@ Clone the provider $ git clone git@github.com:integrations/terraform-provider-github.git ``` -Enter the provider directory and build the provider +Enter the provider directory and build the provider while specifying an output directory: ```sh -$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-github -$ make build -# or if you're on a mac: -$ gnumake build +$ go build -o ~/go/bin/ +``` + +This enables verifying your locally built provider using examples available in the `examples/` directory. +Note that you will first need to configure your shell to map our provider to the local build: + +```sh +export TF_CLI_CONFIG_FILE=path/to/project/examples/dev.tfrc +``` + +An example file is available in our `examples` directory and resembles: + +```hcl +provider_installation { + dev_overrides { + "integrations/github" = "~/go/bin/" + } + + direct {} +} +``` + +See https://www.terraform.io/docs/cli/config/config-file.html for more details. + +When running examples, you should spot the following warning to confirm you are using a local build: + +```console +Warning: Provider development overrides are in effect + +The following provider development overrides are set in the CLI configuration: + - integrations/github in /Users/jcudit/go/bin ``` ### Developing The Provider -If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.11+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`. +If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.11+ is *required*). + +You may also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`. Recent Go releases may have removed the need for this step however. To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory. @@ -81,11 +134,23 @@ $ go test -v ./... -run TestAccProviderConfigure Commonly required environment variables are listed below: -```console +```sh +# enable debug logging export TF_LOG=DEBUG + +# enable testing of organization scenarios instead of individual or anonymous export GITHUB_ORGANIZATION= -export GITHUB_BASE_URL= + +# enable testing of individual scenarios instead of organizaiton or anonymous export GITHUB_OWNER= + +# enable testing of enterprise appliances +export GITHUB_BASE_URL= + +# leverage helper accounts for tests requiring them +# examples include: +# - https://github.com/github-terraform-test-user +# - https://github.com/terraformtesting export GITHUB_TEST_OWNER= export GITHUB_TEST_ORGANIZATION= export GITHUB_TEST_USER_TOKEN= @@ -110,38 +175,15 @@ Once the token has been created, it must be exported in your environment as `GIT ### GitHub Organization -If you do not have an organization already that you are comfortable running tests against, you will need to [create one](https://help.github.com/en/articles/creating-a-new-organization-from-scratch). The free "Team for Open Source" org type is fine for these tests. The name of the organization must then be exported in your environment as `GITHUB_OWNER`. +If you do not have an organization already that you are comfortable running tests against, you will need to [create one](https://help.github.com/en/articles/creating-a-new-organization-from-scratch). The free "Team for Open Source" org type is fine for these tests. The name of the organization must then be exported in your environment as `GITHUB_ORGANIZATION`. If you are interested in using and/or testing Github's [Team synchronization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/synchronizing-teams-between-your-identity-provider-and-github) feature, please contact a maintainer as special arrangements can be made for your convenience. -### Test Repositories - -In the pasts, tests required pre-existing repositories. The current test suite has been refreshed to have less dependencies like this. Developers would previously have had to set up the following fixtures manually: - -In the organization you are using above, create the following test repositories: - -* `test-repo` - * The description should be `Test description, used in GitHub Terraform provider acceptance test.` - * The website url should be `http://www.example.com` - * Create two topics within the repo named `test-topic` and `second-test-topic` - * In the repo settings, make sure all features and merge button options are enabled. - * Create a `test-branch` branch -* `test-repo-template` - * Configure the repository to be a [Template repository](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-template-repository) - * Create a release on the repository with `tag = v1.0` - -Export an environment variable corresponding to `GITHUB_TEMPLATE_REPOSITORY=test-repo-template`. - -### GitHub Users - -Export your github username (the one you used to create the personal access token above) as `GITHUB_TEST_USER`. You may need to export a different github username as `GITHUB_TEST_COLLABORATOR`. Please note that these usernames cannot be the same as each other, and both of them must be real github usernames. The collaborator user does not need to be added as a collaborator to your test repo or organization, but as the acceptance tests do real things (and will trigger some notifications for this user), you should probably make sure the person you specify knows that you're doing this just to be nice. You can also export `GITHUB_TEST_COLLABORATOR_TOKEN` in order to test the invitation acceptance. - -Additionally the user exported as `GITHUB_TEST_USER` should have a public email address configured in their profile; this should be exported as `GITHUB_TEST_USER_EMAIL` and the Github name exported as `GITHUB_TEST_USER_NAME` (this could be different to your GitHub login). - -Finally, export the ID of the release created in the template repository as `GITHUB_TEMPLATE_REPOSITORY_RELEASE_ID` - ## Resources - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) - [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) - [GitHub Help](https://help.github.com) + + +[acc-daily]: https://github.com/integrations/terraform-provider-github/actions?query=workflow%3A%22Acceptance+Tests+%28All%29%22 \ No newline at end of file diff --git a/examples/dev.tfrc b/examples/dev.tfrc new file mode 100644 index 0000000000..82a9812a63 --- /dev/null +++ b/examples/dev.tfrc @@ -0,0 +1,7 @@ +provider_installation { + dev_overrides { + "integrations/github" = "~/go/bin/" + } + + direct {} +} \ No newline at end of file From 21f85f93290129e5cd6b86bbba3307818f40dbf6 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Fri, 5 Feb 2021 07:52:59 -0500 Subject: [PATCH 37/45] Add Diff Suppression Option To `repository_collaborator` (#683) * add diff suppression option to `repository_collaborator` * fixup! remove comment * remove hardcoded username from test --- examples/repository_collaborator/README.md | 4 +- examples/repository_collaborator/providers.tf | 1 - ...resource_github_repository_collaborator.go | 18 + ...rce_github_repository_collaborator_test.go | 424 ++---------------- .../r/repository_collaborator.html.markdown | 1 + 5 files changed, 67 insertions(+), 381 deletions(-) diff --git a/examples/repository_collaborator/README.md b/examples/repository_collaborator/README.md index 2bff32ee3a..49ff4d3d0e 100644 --- a/examples/repository_collaborator/README.md +++ b/examples/repository_collaborator/README.md @@ -7,7 +7,7 @@ This example will also create a repository in the specified `owner` organization Alternatively, you may use variables passed via command line: ```console -export GITHUB_ORG= +export GITHUB_ORGANIZATION= export GITHUB_TOKEN= export COLLABORATOR_USERNAME= export COLLABORATOR_PERMISSION= @@ -15,7 +15,7 @@ export COLLABORATOR_PERMISSION= ```console terraform apply \ - -var "organization=${GITHUB_ORG}" \ + -var "organization=${GITHUB_ORGANIZATION}" \ -var "github_token=${GITHUB_TOKEN}" \ -var "username=${COLLABORATOR_USERNAME}" \ -var "permission=${COLLABORATOR_PERMISSION}" diff --git a/examples/repository_collaborator/providers.tf b/examples/repository_collaborator/providers.tf index 2ba0931912..6ec2a6fd52 100644 --- a/examples/repository_collaborator/providers.tf +++ b/examples/repository_collaborator/providers.tf @@ -1,5 +1,4 @@ provider "github" { - version = "2.8.0" organization = var.organization token = var.github_token } diff --git a/github/resource_github_repository_collaborator.go b/github/resource_github_repository_collaborator.go index abb59f917b..901d6996c8 100644 --- a/github/resource_github_repository_collaborator.go +++ b/github/resource_github_repository_collaborator.go @@ -15,6 +15,7 @@ func resourceGithubRepositoryCollaborator() *schema.Resource { return &schema.Resource{ Create: resourceGithubRepositoryCollaboratorCreate, Read: resourceGithubRepositoryCollaboratorRead, + Update: resourceGithubRepositoryCollaboratorUpdate, Delete: resourceGithubRepositoryCollaboratorDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, @@ -39,6 +40,19 @@ func resourceGithubRepositoryCollaborator() *schema.Resource { ForceNew: true, Default: "push", ValidateFunc: validateValueFunc([]string{"pull", "triage", "push", "maintain", "admin"}), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + if d.Get("permission_diff_suppression").(bool) { + if new == "triage" || new == "maintain" { + return true + } + } + return false + }, + }, + "permission_diff_suppression": { + Type: schema.TypeBool, + Optional: true, + Default: false, }, "invitation_id": { Type: schema.TypeString, @@ -158,6 +172,10 @@ func resourceGithubRepositoryCollaboratorRead(d *schema.ResourceData, meta inter return nil } +func resourceGithubRepositoryCollaboratorUpdate(d *schema.ResourceData, meta interface{}) error { + return resourceGithubRepositoryCollaboratorRead(d, meta) +} + func resourceGithubRepositoryCollaboratorDelete(d *schema.ResourceData, meta interface{}) error { client := meta.(*Owner).v3client diff --git a/github/resource_github_repository_collaborator_test.go b/github/resource_github_repository_collaborator_test.go index f6bec2b25f..64cc8de347 100644 --- a/github/resource_github_repository_collaborator_test.go +++ b/github/resource_github_repository_collaborator_test.go @@ -1,397 +1,65 @@ package github import ( - "context" - "errors" "fmt" - "regexp" - "strings" "testing" - "github.com/google/go-github/v32/github" "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" ) -// TestAccGithubRepositoryCollaborator_basic adds a collaborator -// with permissions supported by an organization-owned repository -// i.e. admin, triage, push, or pull -func TestAccGithubRepositoryCollaborator_basic(t *testing.T) { - if testCollaborator == "" { - t.Skip("Skipping because `GITHUB_TEST_COLLABORATOR` is not set") - } +func TestAccGithubRepositoryCollaborator(t *testing.T) { - if err := testAccCheckOrganization(); err != nil { - t.Skipf("Skipping because %s", err.Error()) - } + t.Skip("update below to unskip this test run") - rn := "github_repository_collaborator.test_repo_collaborator" - repoName := fmt.Sprintf("tf-acc-test-collab-%s", acctest.RandString(5)) + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) - permissionAdmin := "admin" - permissionTriage := "triage" - permissionPush := "push" - permissionPull := "pull" + t.Run("creates invitations without error", func(t *testing.T) { - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckGithubRepositoryCollaboratorDestroy, - Steps: []resource.TestStep{ - { - Config: testAccGithubRepositoryCollaboratorConfig(repoName, testCollaborator, permissionPull), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubRepositoryCollaboratorExists(rn), - testAccCheckGithubRepositoryCollaboratorPermission(rn, permissionPull), - resource.TestCheckResourceAttr(rn, "permission", permissionPull), - resource.TestMatchResourceAttr(rn, "invitation_id", regexp.MustCompile(`^[0-9]+$`)), - ), - }, - { - Config: testAccGithubRepositoryCollaboratorConfig(repoName, testCollaborator, permissionPush), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubRepositoryCollaboratorExists(rn), - testAccCheckGithubRepositoryCollaboratorPermission(rn, permissionPush), - resource.TestCheckResourceAttr(rn, "permission", permissionPush), - resource.TestMatchResourceAttr(rn, "invitation_id", regexp.MustCompile(`^[0-9]+$`)), - ), - }, - { - Config: testAccGithubRepositoryCollaboratorConfig(repoName, testCollaborator, permissionAdmin), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubRepositoryCollaboratorExists(rn), - testAccCheckGithubRepositoryCollaboratorPermission(rn, permissionAdmin), - resource.TestCheckResourceAttr(rn, "permission", permissionAdmin), - resource.TestMatchResourceAttr(rn, "invitation_id", regexp.MustCompile(`^[0-9]+$`)), - ), - }, - { - Config: testAccGithubRepositoryCollaboratorConfig(repoName, testCollaborator, permissionTriage), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubRepositoryCollaboratorExists(rn), - testAccCheckGithubRepositoryCollaboratorPermission(rn, permissionTriage), - resource.TestCheckResourceAttr(rn, "permission", permissionTriage), - resource.TestMatchResourceAttr(rn, "invitation_id", regexp.MustCompile(`^[0-9]+$`)), - ), - }, - { - ResourceName: rn, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -// TestAccGithubRepositoryCollaborator_basic_personal -// adds a collaborator with permissions supported by -// a personal repository i.e. push -func TestAccGithubRepositoryCollaborator_basic_personal(t *testing.T) { - if testCollaborator == "" { - t.Skip("Skipping because `GITHUB_TEST_COLLABORATOR` is not set") - } - - rn := "github_repository_collaborator.test_repo_collaborator" - repoName := fmt.Sprintf("tf-acc-test-collab-%s", acctest.RandString(5)) - - permissionPush := "push" - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckGithubRepositoryCollaboratorDestroy, - Steps: []resource.TestStep{ - { - Config: testAccGithubRepositoryCollaboratorConfig(repoName, testCollaborator, permissionPush), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubRepositoryCollaboratorExists(rn), - testAccCheckGithubRepositoryCollaboratorPermission(rn, permissionPush), - resource.TestCheckResourceAttr(rn, "permission", permissionPush), - resource.TestMatchResourceAttr(rn, "invitation_id", regexp.MustCompile(`^[0-9]+$`)), - ), - }, - { - ResourceName: rn, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -// TestAccGithubRepositoryCollaborator_caseInsensitive -// adds a collaborator with maintain permissions; -// only supported by an organization-owned repository -func TestAccGithubRepositoryCollaborator_caseInsensitive(t *testing.T) { - if testCollaborator == "" { - t.Skip("Skipping because `GITHUB_TEST_COLLABORATOR` is not set") - } - - if err := testAccCheckOrganization(); err != nil { - t.Skipf("Skipping because %s.", err.Error()) - } - - rn := "github_repository_collaborator.test_repo_collaborator" - repoName := fmt.Sprintf("tf-acc-test-collab-%s", acctest.RandString(5)) - - var origInvitation github.RepositoryInvitation - var otherInvitation github.RepositoryInvitation - - expectedPermission := "maintain" - - otherCase := flipUsernameCase(testCollaborator) - - if testCollaborator == otherCase { - t.Skip("Skipping because `GITHUB_TEST_COLLABORATOR` has no letters to flip case") - } - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckGithubRepositoryCollaboratorDestroy, - Steps: []resource.TestStep{ - { - Config: testAccGithubRepositoryCollaboratorConfig(repoName, testCollaborator, expectedPermission), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubRepositoryCollaboratorInvited(repoName, testCollaborator, &origInvitation), - ), - }, - { - Config: testAccGithubRepositoryCollaboratorConfig(repoName, otherCase, expectedPermission), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubRepositoryCollaboratorInvited(repoName, otherCase, &otherInvitation), - resource.TestCheckResourceAttr(rn, "username", testCollaborator), - testAccGithubRepositoryCollaboratorTheSame(&origInvitation, &otherInvitation), - ), - }, - { - ResourceName: rn, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -// TestAccGithubRepositoryCollaborator_caseInsensitive_personal -// adds a collaborator with push permissions; supported by both -// a personal and an organization-owned repository -func TestAccGithubRepositoryCollaborator_caseInsensitive_personal(t *testing.T) { - if testCollaborator == "" { - t.Skip("Skipping because `GITHUB_TEST_COLLABORATOR` is not set") - } - - rn := "github_repository_collaborator.test_repo_collaborator" - repoName := fmt.Sprintf("tf-acc-test-collab-%s", acctest.RandString(5)) - - var origInvitation github.RepositoryInvitation - var otherInvitation github.RepositoryInvitation - - expectedPermission := "push" - - otherCase := flipUsernameCase(testCollaborator) - - if testCollaborator == otherCase { - t.Skip("Skipping because `GITHUB_TEST_COLLABORATOR` has no letters to flip case") - } - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckGithubRepositoryCollaboratorDestroy, - Steps: []resource.TestStep{ - { - Config: testAccGithubRepositoryCollaboratorConfig(repoName, testCollaborator, expectedPermission), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubRepositoryCollaboratorInvited(repoName, testCollaborator, &origInvitation), - ), - }, - { - Config: testAccGithubRepositoryCollaboratorConfig(repoName, otherCase, expectedPermission), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubRepositoryCollaboratorInvited(repoName, otherCase, &otherInvitation), - resource.TestCheckResourceAttr(rn, "username", testCollaborator), - testAccGithubRepositoryCollaboratorTheSame(&origInvitation, &otherInvitation), - ), - }, - { - ResourceName: rn, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - -func testAccCheckGithubRepositoryCollaboratorDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*Owner).v3client - - for _, rs := range s.RootModule().Resources { - if rs.Type != "github_repository_collaborator" { - continue - } - - o := testAccProvider.Meta().(*Owner).name - r, u, err := parseTwoPartID(rs.Primary.ID, "repository", "username") - if err != nil { - return err - } - - isCollaborator, _, err := conn.Repositories.IsCollaborator(context.TODO(), o, r, u) - - if err != nil { - return err - } - - if isCollaborator { - return fmt.Errorf("Repository collaborator still exists") - } - - return nil - } - - return nil -} - -func testAccCheckGithubRepositoryCollaboratorExists(n string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not Found: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("No membership ID is set") - } - - conn := testAccProvider.Meta().(*Owner).v3client - owner := testAccProvider.Meta().(*Owner).name - repoName, username, err := parseTwoPartID(rs.Primary.ID, "repository", "username") - if err != nil { - return err - } - - invitations, _, err := conn.Repositories.ListInvitations(context.TODO(), - owner, repoName, nil) - if err != nil { - return err - } - - hasInvitation := false - for _, i := range invitations { - if i.GetInvitee().GetLogin() == username { - hasInvitation = true - break - } - } - - if !hasInvitation { - return fmt.Errorf("Repository collaboration invitation does not exist") - } - - return nil - } -} - -func testAccCheckGithubRepositoryCollaboratorPermission(n, permission string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not Found: %s", n) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("No membership ID is set") - } - - conn := testAccProvider.Meta().(*Owner).v3client - owner := testAccProvider.Meta().(*Owner).name - repoName, username, err := parseTwoPartID(rs.Primary.ID, "repository", "username") - if err != nil { - return err - } - - invitations, _, err := conn.Repositories.ListInvitations(context.TODO(), - owner, repoName, nil) - if err != nil { - return err - } - - for _, i := range invitations { - if i.GetInvitee().GetLogin() == username { - permName, err := getInvitationPermission(i) - - if err != nil { - return err - } - - if permName != permission { - return fmt.Errorf("Expected permission %s on repository collaborator, actual permission %s", permission, permName) - } - - return nil - } - } - - return fmt.Errorf("Repository collaborator did not appear in list of collaborators on repository") - } -} - -func testAccGithubRepositoryCollaboratorConfig(repoName, username, permission string) string { - return fmt.Sprintf(` -resource "github_repository" "test" { - name = "%s" -} - -resource "github_repository_collaborator" "test_repo_collaborator" { - repository = "${github_repository.test.name}" - username = "%s" - permission = "%s" -} -`, repoName, username, permission) -} - -func testAccCheckGithubRepositoryCollaboratorInvited(repoName, username string, invitation *github.RepositoryInvitation) resource.TestCheckFunc { - return func(s *terraform.State) error { - opt := &github.ListOptions{PerPage: maxPerPage} - - client := testAccProvider.Meta().(*Owner).v3client - owner := testAccProvider.Meta().(*Owner).name - - for { - invitations, resp, err := client.Repositories.ListInvitations(context.TODO(), owner, repoName, opt) - if err != nil { - return errors.New(err.Error()) - } - - if len(invitations) > 1 { - return fmt.Errorf("multiple invitations have been sent for repository %s", repoName) + config := fmt.Sprintf(` + resource "github_repository" "test" { + name = "tf-acc-test-%s" + auto_init = true } - for _, i := range invitations { - if strings.EqualFold(i.GetInvitee().GetLogin(), username) { - invitation = i - return nil - } + resource "github_repository_collaborator" "test_repo_collaborator" { + repository = "${github_repository.test.name}" + username = "" + permission = "triage" } + `, randomID) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "github_repository_collaborator.test_repo_collaborator", "permission", + "triage", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + testCase(t, individual) + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + }) - if resp.NextPage == 0 { - break - } - opt.Page = resp.NextPage - } - - return fmt.Errorf("no invitation found for %s", username) - } -} - -func testAccGithubRepositoryCollaboratorTheSame(orig, other *github.RepositoryInvitation) resource.TestCheckFunc { - return func(s *terraform.State) error { - if orig.GetID() != other.GetID() { - return errors.New("collaborators are different") - } - - return nil - } } diff --git a/website/docs/r/repository_collaborator.html.markdown b/website/docs/r/repository_collaborator.html.markdown index 482c66031a..f3f065d17e 100644 --- a/website/docs/r/repository_collaborator.html.markdown +++ b/website/docs/r/repository_collaborator.html.markdown @@ -46,6 +46,7 @@ The following arguments are supported: * `permission` - (Optional) The permission of the outside collaborator for the repository. Must be one of `pull`, `push`, `maintain`, `triage` or `admin` for organization-owned repositories. Must be `push` for personal repositories. Defaults to `push`. +* `permission_diff_suppression` - (Optional) Suppress plan diffs for `triage` and `maintain`. Defaults to `false`. ## Attribute Reference From 140e5ab35dece23f0d6de6cd8de2ec3b587038a6 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Fri, 5 Feb 2021 08:00:31 -0500 Subject: [PATCH 38/45] Update CHANGELOG for v4.4.0 release --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16c248c3e3..f956f09144 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ BUG FIXES: - Add `create_default_maintainer` option to `github_team` ([#527](https://github.com/integrations/terraform-provider-github/pull/527)), ([#104](https://github.com/integrations/terraform-provider-github/pull/104)), ([#130](https://github.com/integrations/terraform-provider-github/pull/130)) +- Add diff-suppression option to `repository_collaborator` ([#683](https://github.com/integrations/terraform-provider-github/pull/683)) ## 4.3.2 (February 2, 2021) From 2342771d597744227b8f739e8eed897d70a5da3c Mon Sep 17 00:00:00 2001 From: Michael Barany <1434605+mbarany@users.noreply.github.com> Date: Wed, 10 Feb 2021 17:15:08 -0500 Subject: [PATCH 39/45] Add repo context to error message when branch is not found (#691) * Add repo context to error message when branch is not found * fix failing `TestAccGithubRepositoryFile` test access committer data through `Commit` struct Co-authored-by: Jeremy Udit --- github/resource_github_repository_file.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github/resource_github_repository_file.go b/github/resource_github_repository_file.go index 87cd695691..ec38c53de2 100644 --- a/github/resource_github_repository_file.go +++ b/github/resource_github_repository_file.go @@ -259,8 +259,8 @@ func resourceGithubRepositoryFileRead(d *schema.ResourceData, meta interface{}) } d.Set("commit_sha", commit.GetSHA()) - d.Set("commit_author", commit.GetCommitter().GetName()) - d.Set("commit_email", commit.GetCommitter().GetEmail()) + d.Set("commit_author", commit.Commit.GetCommitter().GetName()) + d.Set("commit_email", commit.Commit.GetCommitter().GetEmail()) d.Set("commit_message", commit.GetCommit().GetMessage()) return nil @@ -335,7 +335,7 @@ func checkRepositoryBranchExists(client *github.Client, owner, repo, branch stri if err != nil { if ghErr, ok := err.(*github.ErrorResponse); ok { if ghErr.Response.StatusCode == http.StatusNotFound { - return fmt.Errorf("Branch %s not found in repository or repository is not readable", branch) + return fmt.Errorf("Branch %s not found in repository %s/%s or repository is not readable", branch, owner, repo) } } return err From 512343c8d9c931dec7b454d57c43a2dc50c82e6c Mon Sep 17 00:00:00 2001 From: Shu Kutsuzawa Date: Thu, 11 Feb 2021 07:32:13 +0900 Subject: [PATCH 40/45] fix based on linter (#694) --- github/resource_github_branch_protection.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github/resource_github_branch_protection.go b/github/resource_github_branch_protection.go index 5e74306830..21311a7973 100644 --- a/github/resource_github_branch_protection.go +++ b/github/resource_github_branch_protection.go @@ -173,7 +173,7 @@ func resourceGithubBranchProtectionRead(d *schema.ResourceData, meta interface{} "id": d.Id(), } - ctx := context.WithValue(context.Background(), "id", d.Id()) + ctx := context.WithValue(context.Background(), ctxId, d.Id()) client := meta.(*Owner).v4client err := client.Query(ctx, &query, variables) if err != nil { @@ -266,7 +266,7 @@ func resourceGithubBranchProtectionUpdate(d *schema.ResourceData, meta interface ReviewDismissalActorIDs: githubv4NewIDSlice(githubv4IDSlice(data.ReviewDismissalActorIDs)), } - ctx := context.WithValue(context.Background(), "id", d.Id()) + ctx := context.WithValue(context.Background(), ctxId, d.Id()) client := meta.(*Owner).v4client err = client.Mutate(ctx, &mutate, input, nil) if err != nil { @@ -288,7 +288,7 @@ func resourceGithubBranchProtectionDelete(d *schema.ResourceData, meta interface BranchProtectionRuleID: d.Id(), } - ctx := context.WithValue(context.Background(), "id", d.Id()) + ctx := context.WithValue(context.Background(), ctxId, d.Id()) client := meta.(*Owner).v4client err := client.Mutate(ctx, &mutate, input, nil) From 2d5e38faa12bcb40cbb3efcdbeea37865671f856 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Wed, 17 Feb 2021 18:58:28 -0500 Subject: [PATCH 41/45] add v4.4.1 release notes --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f956f09144..cf4d589962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 4.4.1 (February 17, 2021) + +BUG FIXES: + +- Add more context to error messaging for `github_branch_protection` (#691) +- Satisfy linter recommendation for `github_branch_protection` (#694) + ## 4.4.0 (February 5, 2021) BUG FIXES: From 97c79573fd87d370a057049652508ea5bef16e60 Mon Sep 17 00:00:00 2001 From: Kevin Zhao Date: Wed, 17 Feb 2021 16:16:36 -0800 Subject: [PATCH 42/45] Modify github_team_repository to accept slug as a valid team_id as well (#693) * First attempt * Add comment * Attempt to modify unit tests * Edit docs to reflect change * Make sure team_id is set appropriately * fixing lint * add passing tests for `github_team_repository` Co-authored-by: Jeremy Udit --- github/resource_github_team_repository.go | 40 ++- .../resource_github_team_repository_test.go | 328 ++++++++---------- github/util.go | 33 ++ website/docs/r/team_repository.html.markdown | 2 +- 4 files changed, 200 insertions(+), 203 deletions(-) diff --git a/github/resource_github_team_repository.go b/github/resource_github_team_repository.go index d59535ea5a..0091b0f786 100644 --- a/github/resource_github_team_repository.go +++ b/github/resource_github_team_repository.go @@ -22,10 +22,10 @@ func resourceGithubTeamRepository() *schema.Resource { Schema: map[string]*schema.Schema{ "team_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validateTeamIDFunc, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "ID or slug of team", }, "repository": { Type: schema.TypeString, @@ -55,18 +55,20 @@ func resourceGithubTeamRepositoryCreate(d *schema.ResourceData, meta interface{} client := meta.(*Owner).v3client orgId := meta.(*Owner).id - teamIdString := d.Get("team_id").(string) - teamId, err := strconv.ParseInt(teamIdString, 10, 64) + // The given team id could be an id or a slug + givenTeamId := d.Get("team_id").(string) + teamId, err := getTeamID(givenTeamId, meta) if err != nil { - return unconvertibleIdErr(teamIdString, err) + return err } + orgName := meta.(*Owner).name repoName := d.Get("repository").(string) permission := d.Get("permission").(string) ctx := context.Background() log.Printf("[DEBUG] Creating team repository association: %s:%s (%s/%s)", - teamIdString, permission, orgName, repoName) + givenTeamId, permission, orgName, repoName) _, err = client.Teams.AddTeamRepoByID(ctx, orgId, teamId, @@ -81,7 +83,7 @@ func resourceGithubTeamRepositoryCreate(d *schema.ResourceData, meta interface{} return err } - d.SetId(buildTwoPartID(teamIdString, repoName)) + d.SetId(buildTwoPartID(strconv.FormatInt(teamId, 10), repoName)) return resourceGithubTeamRepositoryRead(d, meta) } @@ -99,7 +101,6 @@ func resourceGithubTeamRepositoryRead(d *schema.ResourceData, meta interface{}) if err != nil { return err } - teamId, err := strconv.ParseInt(teamIdString, 10, 64) if err != nil { return unconvertibleIdErr(teamIdString, err) @@ -128,7 +129,11 @@ func resourceGithubTeamRepositoryRead(d *schema.ResourceData, meta interface{}) } d.Set("etag", resp.Header.Get("ETag")) - d.Set("team_id", teamIdString) + if d.Get("team_id") == "" { + // If team_id is empty, that means we are importing the resource. + // Set the team_id to be the id of the team. + d.Set("team_id", teamIdString) + } d.Set("repository", repo.GetName()) permName, permErr := getRepoPermission(repo.GetPermissions()) @@ -150,13 +155,15 @@ func resourceGithubTeamRepositoryUpdate(d *schema.ResourceData, meta interface{} client := meta.(*Owner).v3client orgId := meta.(*Owner).id - teamIdString := d.Get("team_id").(string) + teamIdString, repoName, err := parseTwoPartID(d.Id(), "team_id", "repository") + if err != nil { + return err + } teamId, err := strconv.ParseInt(teamIdString, 10, 64) if err != nil { return unconvertibleIdErr(teamIdString, err) } orgName := meta.(*Owner).name - repoName := d.Get("repository").(string) permission := d.Get("permission").(string) ctx := context.WithValue(context.Background(), ctxId, d.Id()) @@ -190,14 +197,15 @@ func resourceGithubTeamRepositoryDelete(d *schema.ResourceData, meta interface{} client := meta.(*Owner).v3client orgId := meta.(*Owner).id - teamIdString := d.Get("team_id").(string) - + teamIdString, repoName, err := parseTwoPartID(d.Id(), "team_id", "repository") + if err != nil { + return err + } teamId, err := strconv.ParseInt(teamIdString, 10, 64) if err != nil { return unconvertibleIdErr(teamIdString, err) } orgName := meta.(*Owner).name - repoName := d.Get("repository").(string) ctx := context.WithValue(context.Background(), ctxId, d.Id()) log.Printf("[DEBUG] Deleting team repository association: %s (%s/%s)", diff --git a/github/resource_github_team_repository_test.go b/github/resource_github_team_repository_test.go index 9d546b2946..1df45f6de4 100644 --- a/github/resource_github_team_repository_test.go +++ b/github/resource_github_team_repository_test.go @@ -1,217 +1,173 @@ package github import ( - "context" "fmt" - "strconv" + "strings" "testing" - "github.com/google/go-github/v32/github" "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/terraform" ) -func TestAccGithubTeamRepository_basic(t *testing.T) { - if err := testAccCheckOrganization(); err != nil { - t.Skipf("Skipping because %s.", err.Error()) - } - - var repository github.Repository - - rn := "github_team_repository.test_team_test_repo" - randString := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) - repoName := fmt.Sprintf("tf-acc-test-team-%s", acctest.RandString(5)) - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckGithubTeamRepositoryDestroy, - Steps: []resource.TestStep{ - { - Config: testAccGithubTeamRepositoryConfig(randString, repoName), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubTeamRepositoryExists(rn, &repository), - testAccCheckGithubTeamRepositoryRoleState("pull", &repository), - ), - }, - { - Config: testAccGithubTeamRepositoryUpdateConfig(randString, repoName), - Check: resource.ComposeTestCheckFunc( - testAccCheckGithubTeamRepositoryExists(rn, &repository), - testAccCheckGithubTeamRepositoryRoleState("push", &repository), - ), - }, - { - ResourceName: rn, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} +func TestAccGithubTeamRepository(t *testing.T) { -func TestAccCheckGetPermissions(t *testing.T) { - pullMap := map[string]bool{"pull": true, "triage": false, "push": false, "maintain": false, "admin": false} - triageMap := map[string]bool{"pull": false, "triage": true, "push": false, "maintain": false, "admin": false} - pushMap := map[string]bool{"pull": true, "triage": false, "push": true, "maintain": false, "admin": false} - maintainMap := map[string]bool{"pull": false, "triage": false, "push": false, "maintain": true, "admin": false} - adminMap := map[string]bool{"pull": true, "triage": false, "push": true, "maintain": false, "admin": true} - errorMap := map[string]bool{"pull": false, "triage": false, "push": false, "maintain": false, "admin": false} - - pull, _ := getRepoPermission(pullMap) - if pull != "pull" { - t.Fatalf("Expected pull permission, actual: %s", pull) - } - - triage, _ := getRepoPermission(triageMap) - if triage != "triage" { - t.Fatalf("Expected triage permission, actual: %s", triage) - } - - push, _ := getRepoPermission(pushMap) - if push != "push" { - t.Fatalf("Expected push permission, actual: %s", push) - } - - maintain, _ := getRepoPermission(maintainMap) - if maintain != "maintain" { - t.Fatalf("Expected maintain permission, actual: %s", maintain) - } - - admin, _ := getRepoPermission(adminMap) - if admin != "admin" { - t.Fatalf("Expected admin permission, actual: %s", admin) - } - - errPerm, err := getRepoPermission(errorMap) - if err == nil { - t.Fatalf("Expected an error getting permissions, actual: %v", errPerm) - } -} + randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum) -func testAccCheckGithubTeamRepositoryRoleState(role string, repository *github.Repository) resource.TestCheckFunc { - return func(s *terraform.State) error { - resourceRole, err := getRepoPermission(repository.GetPermissions()) - if err != nil { - return err - } + t.Run("manages team permissions to a repository", func(t *testing.T) { - if resourceRole != role { - return fmt.Errorf("Team repository role %v in resource does match expected state of %v", resourceRole, role) - } - return nil - } -} - -func testAccCheckGithubTeamRepositoryExists(n string, repository *github.Repository) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not Found: %s", n) - } + config := fmt.Sprintf(` + resource "github_team" "test" { + name = "tf-acc-test-team-repo-%s" + description = "test" + } - if rs.Primary.ID == "" { - return fmt.Errorf("No team repository ID is set") - } + resource "github_repository" "test" { + name = "tf-acc-test-%[1]s" + } - conn := testAccProvider.Meta().(*Owner).v3client + resource "github_team_repository" "test" { + team_id = "${github_team.test.id}" + repository = "${github_repository.test.name}" + permission = "pull" + } + `, randomID) - teamIdString, repoName, err := parseTwoPartID(rs.Primary.ID, "team_id", "repository") - if err != nil { - return err - } - teamId, err := strconv.ParseInt(teamIdString, 10, 64) - if err != nil { - return unconvertibleIdErr(teamIdString, err) + checks := map[string]resource.TestCheckFunc{ + "pull": resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "github_team_repository.test", "permission", + "pull", + ), + ), + "triage": resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "github_team_repository.test", "permission", + "triage", + ), + ), + "push": resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "github_team_repository.test", "permission", + "push", + ), + ), + "maintain": resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "github_team_repository.test", "permission", + "maintain", + ), + ), + "admin": resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr( + "github_team_repository.test", "permission", + "admin", + ), + ), } - repo, _, err := conn.Teams.IsTeamRepoByID(context.TODO(), - testAccProvider.Meta().(*Owner).id, - teamId, - testAccProvider.Meta().(*Owner).name, - repoName) - - if err != nil { - return err + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: checks["pull"], + }, + { + Config: strings.Replace(config, + `permission = "pull"`, + `permission = "triage"`, 1), + Check: checks["triage"], + }, + { + Config: strings.Replace(config, + `permission = "pull"`, + `permission = "push"`, 1), + Check: checks["push"], + }, + { + Config: strings.Replace(config, + `permission = "pull"`, + `permission = "maintain"`, 1), + Check: checks["maintain"], + }, + { + Config: strings.Replace(config, + `permission = "pull"`, + `permission = "admin"`, 1), + Check: checks["admin"], + }, + }, + }) } - *repository = *repo - return nil - } -} -func testAccCheckGithubTeamRepositoryDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*Owner).v3client - orgId := testAccProvider.Meta().(*Owner).id + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) - for _, rs := range s.RootModule().Resources { - if rs.Type != "github_team_repository" { - continue - } + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) - teamIdString, repoName, err := parseTwoPartID(rs.Primary.ID, "team_id", "repository") - if err != nil { - return err - } - teamId, err := strconv.ParseInt(teamIdString, 10, 64) - if err != nil { - return unconvertibleIdErr(teamIdString, err) - } + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) - repo, resp, err := conn.Teams.IsTeamRepoByID(context.TODO(), - orgId, - teamId, - testAccProvider.Meta().(*Owner).name, - repoName) + }) - if err == nil { - if repo != nil && - buildTwoPartID(teamIdString, repo.GetName()) == rs.Primary.ID { - return fmt.Errorf("Team repository still exists") - } - } - if resp.StatusCode != 404 { - return err - } - return nil - } - return nil -} + t.Run("accepts both team slug and team ID for `team_id`", func(t *testing.T) { -func testAccGithubTeamRepositoryConfig(randString, repoName string) string { - return fmt.Sprintf(` -resource "github_team" "test_team" { - name = "tf-acc-test-team-repo-%s" - description = "Terraform acc test group" -} + config := fmt.Sprintf(` + resource "github_team" "test" { + name = "tf-acc-test-team-repo-%s" + description = "test" + } -resource "github_repository" "test" { - name = "%s" -} + resource "github_repository" "test" { + name = "tf-acc-test-%[1]s" + } -resource "github_team_repository" "test_team_test_repo" { - team_id = "${github_team.test_team.id}" - repository = "${github_repository.test.name}" - permission = "pull" -} -`, randString, repoName) -} + resource "github_team_repository" "test" { + team_id = "${github_team.test.slug}" + repository = "${github_repository.test.name}" + permission = "pull" + } + `, randomID) + + check := resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("github_team_repository.test", "team_id"), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + { + Config: strings.Replace(config, + `github_team.test.id`, + `github_team.test.slug`, 1), + Check: check, + }, + }, + }) + } -func testAccGithubTeamRepositoryUpdateConfig(randString, repoName string) string { - return fmt.Sprintf(` -resource "github_team" "test_team" { - name = "tf-acc-test-team-repo-%s" - description = "Terraform acc test group" -} + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) -resource "github_repository" "test" { - name = "%s" -} + t.Run("with an individual account", func(t *testing.T) { + t.Skip("individual account not supported for this operation") + }) -resource "github_team_repository" "test_team_test_repo" { - team_id = "${github_team.test_team.id}" - repository = "${github_repository.test.name}" - permission = "push" -} -`, randString, repoName) + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + }) } diff --git a/github/util.go b/github/util.go index 3b82a0cf45..3c7f147dcc 100644 --- a/github/util.go +++ b/github/util.go @@ -1,6 +1,8 @@ package github import ( + "context" + "errors" "fmt" "strconv" "strings" @@ -110,3 +112,34 @@ func splitRepoFilePath(path string) (string, string) { parts := strings.Split(path, "/") return parts[0], strings.Join(parts[1:], "/") } + +func getTeamID(teamIDString string, meta interface{}) (int64, error) { + // Given a string that is either a team id or team slug, return the + // id of the team it is referring to. + ctx := context.Background() + client := meta.(*Owner).v3client + orgName := meta.(*Owner).name + orgId := meta.(*Owner).id + + teamId, parseIntErr := strconv.ParseInt(teamIDString, 10, 64) + if parseIntErr != nil { + // The given id not an integer, assume it is a team slug + team, _, slugErr := client.Teams.GetTeamBySlug(ctx, orgName, teamIDString) + if slugErr != nil { + return -1, errors.New(parseIntErr.Error() + slugErr.Error()) + } + return team.GetID(), nil + } else { + // The given id is an integer, assume it is a team id + team, _, teamIdErr := client.Teams.GetTeamByID(ctx, orgId, teamId) + if teamIdErr != nil { + // There isn't a team with the given ID, assume it is a teamslug + team, _, slugErr := client.Teams.GetTeamBySlug(ctx, orgName, teamIDString) + if slugErr != nil { + return -1, errors.New(teamIdErr.Error() + slugErr.Error()) + } + return team.GetID(), nil + } + return team.GetID(), nil + } +} diff --git a/website/docs/r/team_repository.html.markdown b/website/docs/r/team_repository.html.markdown index de2c91cb8a..9d8cb84ccf 100644 --- a/website/docs/r/team_repository.html.markdown +++ b/website/docs/r/team_repository.html.markdown @@ -41,7 +41,7 @@ resource "github_team_repository" "some_team_repo" { The following arguments are supported: -* `team_id` - (Required) The GitHub team id +* `team_id` - (Required) The GitHub team id or the GitHub team slug * `repository` - (Required) The repository to add to the team. * `permission` - (Optional) The permissions of team members regarding the repository. Must be one of `pull`, `triage`, `push`, `maintain`, or `admin`. Defaults to `pull`. From 61238b98abe8153458ea71f8165ed1987f0bd52d Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Wed, 17 Feb 2021 19:20:58 -0500 Subject: [PATCH 43/45] add v4.5.0 release notes --- CHANGELOG.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf4d589962..b494b1a3d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,16 @@ +## 4.5.0 (February 17, 2021) + +ENHANCEMENTS: + +- Add ability for `github_team_repository` to accept slug as a valid `team_id` ([#693](https://github.com/integrations/terraform-provider-github/pull/693)) + ## 4.4.1 (February 17, 2021) BUG FIXES: -- Add more context to error messaging for `github_branch_protection` (#691) -- Satisfy linter recommendation for `github_branch_protection` (#694) +- Add more context to error messaging for `github_branch_protection` ([#691](https://github.com/integrations/terraform-provider-github/pull/691)) +- Satisfy linter recommendation for `github_branch_protection` ([#694](https://github.com/integrations/terraform-provider-github/pull/694)) + ## 4.4.0 (February 5, 2021) From 22d938819855334a1c6e399b4ce68f8f984749ee Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Wed, 17 Feb 2021 19:42:26 -0500 Subject: [PATCH 44/45] temporarily ignore `darwin/arm64` to unblock releases /cc https://github.com/integrations/terraform-provider-github/issues/695 --- .goreleaser.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 77d63556d8..3158651efa 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -26,6 +26,8 @@ builds: - arm - arm64 ignore: + - goos: darwin + goarch: arm64 - goos: darwin goarch: '386' binary: '{{ .ProjectName }}_v{{ .Version }}' From 8defb41ba14be0b07017d3af072942c4cc7abc01 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Wed, 17 Feb 2021 19:45:33 -0500 Subject: [PATCH 45/45] update release notes for v4.5.0 --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b494b1a3d4..a101c20af5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,14 +4,11 @@ ENHANCEMENTS: - Add ability for `github_team_repository` to accept slug as a valid `team_id` ([#693](https://github.com/integrations/terraform-provider-github/pull/693)) -## 4.4.1 (February 17, 2021) - BUG FIXES: - Add more context to error messaging for `github_branch_protection` ([#691](https://github.com/integrations/terraform-provider-github/pull/691)) - Satisfy linter recommendation for `github_branch_protection` ([#694](https://github.com/integrations/terraform-provider-github/pull/694)) - ## 4.4.0 (February 5, 2021) BUG FIXES: