Skip to content

Commit

Permalink
Make --no-shell not exit early
Browse files Browse the repository at this point in the history
This makes `--no-shell --post-result` with multiple PRs post more than just the first report.
  • Loading branch information
pbsds authored and Mic92 committed Jun 8, 2024
1 parent 14339ad commit 29249cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion nixpkgs_review/cli/pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,14 @@ def pr_command(args: argparse.Namespace) -> str:
warn(f"https://github.com/NixOS/nixpkgs/pull/{pr} failed to build: {e}")
assert review is not None

all_succeeded = True
for pr, path, attrs in contexts:
review.start_review(attrs, path, pr, args.post_result, args.print_result)
all_succeeded &= review.start_review(
attrs, path, pr, args.post_result, args.print_result
)

if args.no_shell:
sys.exit(0 if all_succeeded else 1)

if len(contexts) != len(prs):
sys.exit(1)
Expand Down
8 changes: 4 additions & 4 deletions nixpkgs_review/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def start_review(
pr: int | None = None,
post_result: bool | None = False,
print_result: bool = False,
) -> None:
) -> bool:
os.environ.pop("NIXPKGS_CONFIG", None)
os.environ["NIXPKGS_REVIEW_ROOT"] = str(path)
if pr:
Expand All @@ -282,9 +282,7 @@ def start_review(
if print_result:
print(report.markdown(pr))

if self.no_shell:
sys.exit(0 if report.succeeded() else 1)
else:
if not self.no_shell:
nix_shell(
report.built_packages(),
path,
Expand All @@ -297,6 +295,8 @@ def start_review(
self.sandbox,
)

return report.succeeded()

def review_commit(
self,
path: Path,
Expand Down

0 comments on commit 29249cb

Please sign in to comment.