8000 Repository environment creation fails on private Teams repos · Issue #2602 · google/go-github · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Repository environment creation fails on private Teams repos #2602
Closed
@AnitaErnszt

Description

@AnitaErnszt

This is related to the discussion on the integrations/terraform-provider-github#1262

In June GitHub made the environments and environment protection rules generally available, however, the wait_timer and reviewers remains limited to enterprise.

Many developers would like to make use of this great new feature, but the bug in the Terraform provider currently proves to be a blocker.
The provider uses the go-github Go library under the hood and makes the following call:

_, _, err := client.Repositories.CreateUpdateEnvironment(ctx, owner, repoName, escapedEnvName, &updateData)

where the &updateData is a github.CreateUpdateEnvironment struct.

Looking at the code it seems that instead of sending nil value for wait_timer it defaults to 0.

// CreateUpdateEnvironment represents the fields required for the create/update operation
// following the Create/Update release example.
// See https://github.com/google/go-github/issues/992 for more information.
// Removed omitempty here as the API expects null values for reviewers and deployment_branch_policy to clear them.
type CreateUpdateEnvironment struct {
	WaitTimer              *int            `json:"wait_timer"`
	Reviewers              []*EnvReviewers `json:"reviewers"`
	DeploymentBranchPolicy *BranchPolicy   `json:"deployment_branch_policy"`
}

This is causing the issue for us, as the API doesn't expect this parameter and returns 422.

I understand why the omitempty was removed, so I'm looking at what alternative solutions are possible to ensure environments fully work regardless of the payment plan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0