Skip to content

Commit 88fcdd8

Browse files
committed
When NIXPKGS_REVIEW_OFBORG_GIST_URL is set, use it as the default URL from which to fetch the ofborg evalation.
This is not required for normal users, but can be useful when nixpkgs-review is run as part of a distributed system like r-rmcgibbo, and you want to use an ofborg evaluation that has since been invalidated by a force-push to the PR and you do not want to fall back to local evaluation.
1 parent 55d3c53 commit 88fcdd8

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

nixpkgs_review/github.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def pull_request(self, number: int) -> Any:
114114
def get_borg_eval_gist(self, pr: Dict[str, Any]) -> Optional[Dict[str, Set[str]]]:
115115
packages_per_system: DefaultDict[str, Set[str]] = defaultdict(set)
116116
statuses = self.get(pr["statuses_url"])
117+
raw_gist_url = os.environ.get("NIXPKGS_REVIEW_OFBORG_GIST_URL")
117118
for status in statuses:
118119
url = status.get("target_url", "")
119120
if (
@@ -125,12 +126,15 @@ def get_borg_eval_gist(self, pr: Dict[str, Any]) -> Optional[Dict[str, Set[str]]
125126
raw_gist_url = (
126127
f"https://gist.githubusercontent.com/GrahamcOfBorg{url.path}/raw/"
127128
)
128-
for line in urllib.request.urlopen(raw_gist_url):
129-
if line == b"":
130-
break
131-
system, attribute = line.decode("utf-8").split()
132-
packages_per_system[system].add(attribute)
133-
return packages_per_system
129+
break
130+
131+
if raw_gist_url is not None:
132+
for line in urllib.request.urlopen(raw_gist_url):
133+
if line == b"":
134+
break
135+
system, attribute = line.decode("utf-8").split()
136+
packages_per_system[system].add(attribute)
137+
return packages_per_system
134138
return None
135139

136140
def upload_gist(self, name: str, content: str, description: str) -> Dict[str, Any]:

0 commit comments

Comments
 (0)