fake-api-server.ci.surveillance.model.config.github_action¶
This module provides functionality to manage and retrieve GitHub Actions environment variables.
It includes a dataclass GitHubActionEnvironmentVariable
for deserialization and accessing relevant
environment variables that control repository configuration and authentication in GitHub Actions workflows.
GitHubActionEnvironmentVariable(github_actions=False, repository=str(), repository_owner_name=str(), repository_name=str(), base_branch=str(), head_branch=str(), github_token=str())
dataclass
¶
Bases: _BaseModel
Represents environment variables specific to a GitHub Action execution context.
This class is used to define and process the environment variables related to GitHub Actions. It includes attributes to store details about the repository, branches, and authentication token. The purpose of this class is to manage and deserialize the environment data provided by GitHub Actions into a usable data object.
ATTRIBUTE | DESCRIPTION |
---|---|
github_actions |
Indicates if the environment corresponds to a GitHub Action execution.
TYPE:
|
repository |
The full repository name in the format 'owner/repo'.
TYPE:
|
repository_owner_name |
The owner name of the repository.
TYPE:
|
repository_name |
The name of the repository.
TYPE:
|
base_branch |
The name of the base branch of the repository.
TYPE:
|
head_branch |
The name of the head branch of the repository.
TYPE:
|
github_token |
The authentication token provided for GitHub Actions.
TYPE:
|
get_github_action_env()
¶
Gets the global GitHub action environment variable. This method ensures a singleton pattern for the GitHub action environment variable by reusing the previously deserialized value or deserializing the current operating system environment variables if it hasn't been initialized yet.
RETURNS | DESCRIPTION |
---|---|
GitHubActionEnvironmentVariable
|
The GitHub action environment variable. |
RAISES | DESCRIPTION |
---|---|
GitHubActionEnvironmentVariableError
|
If deserialization encounters an issue while processing the operating system's environment variables. |