Skip to content

Environment variables as objects? #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
killermoehre opened this issue May 19, 2023 · 0 comments · May be fixed by #25
Open

Environment variables as objects? #24

killermoehre opened this issue May 19, 2023 · 0 comments · May be fixed by #25

Comments

@killermoehre
Copy link

killermoehre commented May 19, 2023

Hi,

I'm thinking about a dataclass containing all the default variables like

from github_action_utils import vars
# vars.ci == True
# vars.github.event_path == '/github/workflow/event.json'

and so on. So every first _ in a variable name would actually open a new sub-level.
All values would be read-only. With appropriate __doc__ strings this would allow for great integration in any IDE.

The goal would be to reduce boilerplate code like

GITHUB = {
    "SERVER_URL": github_action_utils.get_env("GITHUB_SERVER_URL"),
    "REPOSITORY": github_action_utils.get_env("GITHUB_REPOSITORY"),
    "RUN_NUMBER": github_action_utils.get_env("GITHUB_RUN_NUMBER"),
}

Opinions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant