spcd/cd/project.py
Marc Beninca fedeec960d
Some checks failed
/ job (push) Failing after 7s
fixes
2024-04-27 17:09:51 +02:00

25 lines
603 B
Python

from os import path
BRANCH = [
'GITHUB_REF_NAME',
'CI_COMMIT_BRANCH',
]
NAME = [
'GITHUB_REPOSITORY',
'CI_PROJECT_PATH',
]
class Project:
def __init__(self, projects):
self.projects = projects
# branch
for variable in BRANCH:
if value := projects.environment.get(variable, None):
self.branch = value
# name
for variable in NAME:
if value := projects.environment.get(variable, None):
self.name = path.basename(value)
# url
self.url = path.join(projects.url, self.name)