Skip to content

Commit 861e04e

Browse files
authored
fix(#6): env var GITLAB_CI is not set
1 parent be066ff commit 861e04e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

gitflow_toolbox/common/get_current_gitlab.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import gitlab
24

35
from gitflow_toolbox.common.get_env import get_env
@@ -10,7 +12,7 @@ def get_current_gitlab() -> gitlab.Gitlab:
1012
gitlab.Gitlab: current gitlab instance (or 'source', 'from' gitlab)
1113
"""
1214
# If running in a gitlab CI job
13-
if get_env("GITLAB_CI"):
15+
if os.getenv("GITLAB_CI"):
1416
# Use provided token, if not available, use default token from job
1517
private_token = get_env("GITLAB_PRIVATE_TOKEN", "CI_JOB_TOKEN")
1618
return gitlab.Gitlab(get_env("CI_SERVER_URL"), private_token)

gitflow_toolbox/common/get_current_project.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
from gitlab.v4.objects.projects import Project
24

35
from gitflow_toolbox.common.get_current_gitlab import get_current_gitlab
@@ -12,7 +14,7 @@ def get_current_project() -> Project:
1214
"""
1315
gitlab = get_current_gitlab()
1416
# If running in a gitlab CI job
15-
if get_env("GITLAB_CI"):
17+
if os.getenv("GITLAB_CI"):
1618
# Use provided CI project, if not available, use project from current job
1719
project_id = get_env("GITLAB_PROJECT_ID", "CI_PROJECT_ID")
1820
return gitlab.projects.get(project_id)

0 commit comments

Comments
 (0)