secrets_updater package#
Subpackages#
Submodules#
secrets_updater.github module#
Methods/Classes to interact with GitHub API.
Supports fetching repo_secrets, repo_public_key and creation or update of `repo_secret`
- class secrets_updater.github.GitHubActions(*args, **kwargs)#
Bases:
objectProvides methods to interact with GitHub API.
- async create_or_update_repo_secret(secret_name, secret_value)#
Create repository secret, update if already exists. Uses create-or-update-a-repository-secret endpoint.
Public key is required to encrypt secrets while creating or updating secrets for particular repo.
- Parameters:
secret_name (str) – Name of secrete.
secret_value (utf-8) – Secrete value encrypted using public key.
- Returns:
None
- get_repo_public_key(*args, **kwargs)#
Get repo public key. Uses get-a-repository-public-key endpoint.
Public key is required to encrypt secrets while creating or updating secrets for particular repo.
- Parameters:
*args – Variable length argument list.
**kwargs – Arbitrary keyword arguments.
- Returns:
Containing Public key details. key and key_id.
- Return type:
dict
- Raises:
Exception – if response status code is other than 200.
- get_repo_secrets(*args, **kwargs)#
Get repo secrets. Uses list-repository-secrets endpoint.
- Parameters:
*args – Variable length argument list.
**kwargs – Arbitrary keyword arguments.
- Returns:
Json Response.
- Return type:
dict
- Raises:
Exception – if response status code is other than 200.
secrets_updater.main module#
Wrapper Script to invoke GitHub api and related operations.
See also
- async secrets_updater.main.add_local_env_to_secrets(env_file_path)#
Upload secrets defined in
env_file_pathto GitHub actions.Every secret listed in
env_file_pathwill be updated to repository secrets.Except Secrets starting with#- Parameters:
env_file_path (str) – Complete file path of local environment file.
- secrets_updater.main.add_secretes()#
Invokes async upload action for every env file defined in
ENV_FILE_PATH.All env files defined in
EXCLUDE_ENV_FILES_FROM_UPLOADwill be excluded from upload.
secrets_updater.settings module#
Initialize environment variables.
secrets_updater.utility module#
Helper Functions.
- secrets_updater.utility.encrypt(public_key: str, secret_value: str) str#
Encrypt a Unicode string using the public key.