2024-04-27 14:14:03 +00:00
|
|
|
from os import path
|
|
|
|
|
|
|
|
BRANCH = [
|
|
|
|
'GITHUB_REF_NAME',
|
|
|
|
'CI_COMMIT_BRANCH',
|
|
|
|
]
|
|
|
|
NAME = [
|
|
|
|
'GITHUB_REPOSITORY',
|
|
|
|
'CI_PROJECT_PATH',
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2024-04-27 13:32:33 +00:00
|
|
|
class Project:
|
2024-04-27 14:14:03 +00:00
|
|
|
def __init__(self, environment):
|
|
|
|
# branch
|
|
|
|
for variable in BRANCH:
|
|
|
|
if value := environment.get(variable, None):
|
|
|
|
self.branch = value
|
|
|
|
# name
|
|
|
|
for variable in NAME:
|
|
|
|
if value := environment.get(variable, None):
|
|
|
|
self.name = path.basename(value)
|