Skip to content

Commit a3f1bde

Browse files
test
1 parent 35bf6de commit a3f1bde

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

blueos_repository/consolidate.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
import asyncio
33
import dataclasses
44
import json
5+
import os
56
from pathlib import Path
67
from typing import Any, AsyncIterable, Dict, List, Optional, Union
78

89
import aiohttp
910
import semver
11+
from exceptions import ConfigurationError
1012
from registry import Registry
1113

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

98+
def raise_if_pull_request(self, exception: Exception):
99+
print(os.environ.get())
100+
if os.environ.get("github.event_name", None) == "pull_request":
101+
raise exception
102+
print(exception)
103+
96104
async def all_repositories(self) -> AsyncIterable[RepositoryEntry]:
97105
repos = self.repo_folder()
98106
for repo in repos.glob("**/metadata.json"):
@@ -144,6 +152,10 @@ async def run(self) -> None:
144152
continue
145153
raw_labels = await self.registry.fetch_labels(f"{repository.docker}:{tag}")
146154
permissions = raw_labels.get("permissions", None)
155+
if not permissions:
156+
self.raise_if_pull_request(
157+
ConfigurationError("LABEL permissions is not found. please add it and try again")
158+
)
147159
website = raw_labels.get("website", None)
148160
authors = raw_labels.get("authors", None)
149161
docs = raw_labels.get("docs", None)

blueos_repository/exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ConfigurationError(ValueError):
2+
"""Repository is misconfigured"""

0 commit comments

Comments
 (0)