Environment

class github.Environment.Environment

This class represents Environment.

The reference can be found here https://docs.github.com/en/rest/reference/deployments#environments

A CompletableGithubObject can be partially initialised (completed=False). Accessing attributes that are not initialized will then trigger a request to complete all attributes.

A partially initialized CompletableGithubObject (completed=False) can be completed via complete(). This requires the url to be given via parameter url or attributes.

With a requester where Requester.is_lazy == True, this CompletableGithubObjects is partially initialized. This requires the url to be given via parameter url or attributes. Any CompletableGithubObject created from this lazy object will be lazy itself if created with parameter url or attributes.

Parameters
  • requester – requester

  • headers – response headers

  • attributes – attributes to initialize

  • completed – do not update non-initialized attributes when True

  • url – url of this instance, overrides attributes[‘url’]

  • accept – use this accept header when completing this instance

property environments_url
Type

string

property url
Type

string

get_public_key() → github.PublicKey.PublicKey
Calls

GET /repositories/{repository_id}/environments/{environment_name}/secrets/public-key

Return type

PublicKey

create_secret(secret_name: str, unencrypted_value: str) → github.Secret.Secret
Calls

PUT /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}

get_secrets() → github.PaginatedList.PaginatedList[github.Secret.Secret][github.Secret.Secret]

Gets all repository secrets.

get_secret(secret_name: str) → github.Secret.Secret
Calls

‘GET /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name} <https://docs.github.com/en/rest/secrets#get-an-organization-secret>`_

create_variable(variable_name: str, value: str) → github.Variable.Variable
Calls

POST /repositories/{repository_id}/environments/{environment_name}/variables/{variable_name}

get_variables() → github.PaginatedList.PaginatedList[github.Variable.Variable][github.Variable.Variable]

Gets all repository variables :rtype: PaginatedList of Variable

get_variable(variable_name: str) → github.Variable.Variable
Calls

‘GET /orgs/{org}/variables/{variable_name} <https://docs.github.com/en/rest/variables#get-an-organization-variable>`_

Parameters

variable_name – string

Return type

Variable

delete_secret(secret_name: str) → bool
Calls

DELETE /repositories/{repository_id}/environments/{environment_name}/secrets/{secret_name}

Parameters

secret_name – string

Return type

bool

delete_variable(variable_name: str) → bool
Calls

DELETE /repositories/{repository_id}/environments/{environment_name}/variables/{variable_name}

Parameters

variable_name – string

Return type

bool