Code Monkey home page Code Monkey logo

github-action-utils's Issues

Environment variables as objects?

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?

Detect if the script is running in github action environment

If I'm developing a script that runs either locally or in github action, I may want to detect whether it is running in github action environment, because some functions in github-action-utils is unusable locally.
Although I can detect the environment by using try-catch, I still want a more Pythonic solution in the github-action-utils module. For example, a is_github_action() function that returns a bool.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.