Skip to content

Commit

Permalink
Merge pull request #190 from con/gh-189
Browse files Browse the repository at this point in the history
CircleCI: Handle `null` vcs.provider_name
  • Loading branch information
yarikoptic authored Jun 12, 2024
2 parents 9ca71bc + 97fcd40 commit 1e8efc2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/tinuous/circleci.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get_build_assets(
if self.until is not None:
log.info("Skipping pipelines newer than %s", self.until)
for pipeline in self.get_pipelines():
if pipeline.vcs is None or pipeline.vcs.provider_name.lower() != "github":
if pipeline.vcs is None or not pipeline.vcs.is_github():
log.debug(
"Skipping pipeline %d as it is not associated with GitHub",
pipeline.number,
Expand Down Expand Up @@ -155,9 +155,11 @@ def get_build_assets(
job=job.job_number,
job_id=job.id,
job_name=sanitize_pathname(job.name),
step=str(action.step)
if action.step is not None
else "UNK",
step=(
str(action.step)
if action.step is not None
else "UNK"
),
step_name=sanitize_pathname(step.name),
index=action.index,
)
Expand Down Expand Up @@ -360,7 +362,7 @@ class Trigger(BaseModel):


class VCS(BaseModel):
provider_name: str
provider_name: Optional[str]
# target_repository_url: str
branch: Optional[str] = None
# review_id: Optional[str] = None
Expand All @@ -370,6 +372,9 @@ class VCS(BaseModel):
# commit: Optional[Commit] = None
# origin_repository_url: str

def is_github(self) -> bool:
return self.provider_name is not None and self.provider_name.lower() == "github"


class Pipeline(BaseModel):
id: str
Expand Down

0 comments on commit 1e8efc2

Please sign in to comment.