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.
You can use GITHUB_ACTIONS or CI (Always set to true when GitHub Actions is running the workflow. You can use this variable to differentiate when tests are being run locally or by GitHub Actions.) environment variables to check if you code is running locally or via GitHub Actions.
ref: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
This is the recommended way provided by GitHub.