Skip to content

Commit

Permalink
refactor(utils): leverage strtobool
Browse files Browse the repository at this point in the history
Change-Id: Ibff24d023356bdc10a1a8347295d534c745c4d2d
  • Loading branch information
jd committed Dec 17, 2024
1 parent 6d4f2bb commit 3d2cd3d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pytest_mergify/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@

CIProviderT = typing.Literal["github_actions", "circleci"]

SUPPORTED_CIs = {
"GITHUB_ACTIONS": "github_actions",
"CIRCLECI": "circleci",
}


def get_ci_provider() -> CIProviderT | None:
if os.getenv("GITHUB_ACTIONS") == "true":
return "github_actions"
if os.getenv("CIRCLECI") == "true":
return "circleci"
for envvar, name in SUPPORTED_CIs.items():
if envvar in os.environ and strtobool(os.environ[envvar]):
return name

return None


Expand Down

0 comments on commit 3d2cd3d

Please sign in to comment.