Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Feb 15, 2023
1 parent 35bf6de commit 384bad1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions blueos_repository/consolidate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import asyncio
import dataclasses
import json
import os
from pathlib import Path
from typing import Any, AsyncIterable, Dict, List, Optional, Union

import aiohttp
import semver
from exceptions import ConfigurationError
from registry import Registry

REPO_ROOT = "https://raw.githubusercontent.com/bluerobotics/BlueOS-Extensions-Repository/master/"
Expand Down Expand Up @@ -93,6 +95,12 @@ async def fetch_readme(url: str) -> str:
raise Exception(f"bad response type for readme: {resp.content_type}, expected text/plain")
return await resp.text()

def raise_if_pull_request(self, exception: Exception):
print(os.environ.get())
if os.environ.get('github.event_name', None) == "pull_request":
raise exception
print(exception)

async def all_repositories(self) -> AsyncIterable[RepositoryEntry]:
repos = self.repo_folder()
for repo in repos.glob("**/metadata.json"):
Expand Down Expand Up @@ -144,6 +152,8 @@ async def run(self) -> None:
continue
raw_labels = await self.registry.fetch_labels(f"{repository.docker}:{tag}")
permissions = raw_labels.get("permissions", None)
if not permissions:
self.raise_if_pull_request(ConfigurationError("LABEL permissions is not found. please add it and try again"))
website = raw_labels.get("website", None)
authors = raw_labels.get("authors", None)
docs = raw_labels.get("docs", None)
Expand Down
2 changes: 2 additions & 0 deletions blueos_repository/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ConfigurationError(ValueError):
"""Repository is misconfigured"""

0 comments on commit 384bad1

Please sign in to comment.