multi-pr #21
| @@ -19,7 +19,7 @@ BRANCHES = ["nixos-unstable-small", "nixos-unstable", "nixos-24.05"] | |||||||
|  |  | ||||||
| @app.command() | @app.command() | ||||||
| def pr( | def pr( | ||||||
|     pr: int, |     pr: list[int], | ||||||
|     branches: Annotated[ |     branches: Annotated[ | ||||||
|         list[str] | None, typer.Option(help="Check specific branch") |         list[str] | None, typer.Option(help="Check specific branch") | ||||||
|     ] = None, |     ] = None, | ||||||
| @@ -28,12 +28,15 @@ def pr( | |||||||
|     ] = OutputFormat.CONSOLE, |     ] = OutputFormat.CONSOLE, | ||||||
| ) -> None: | ) -> None: | ||||||
|     """Get merge status of pull request.""" |     """Get merge status of pull request.""" | ||||||
|     if branches: |     if isinstance(pr, int): | ||||||
|         status = pr_merge_status(pr, branches) |         status = pr_merge_status(pr, branches) | ||||||
|     else: |  | ||||||
|         status = pr_merge_status(pr) |  | ||||||
|  |  | ||||||
|         status.print(format=format) |         status.print(format=format) | ||||||
|  |         return | ||||||
|  |  | ||||||
|  |     for pr_ in pr: | ||||||
|  |         status = pr_merge_status(pr_, branches) | ||||||
|  |         status.print(format=format) | ||||||
|  |         print() | ||||||
|  |  | ||||||
|  |  | ||||||
| @app.command() | @app.command() | ||||||
|   | |||||||
| @@ -75,6 +75,8 @@ def get_pr(pr: int) -> dict[str, Any]: | |||||||
| def pr_merge_status( | def pr_merge_status( | ||||||
|     pr: int, branches: list[str] = DEFAULT_BRANCHES, check_backport: bool = True |     pr: int, branches: list[str] = DEFAULT_BRANCHES, check_backport: bool = True | ||||||
| ) -> PRStatus: | ) -> PRStatus: | ||||||
|  |     if not branches: | ||||||
|  |         branches = DEFAULT_BRANCHES | ||||||
|     url = f"https://api.github.com/repos/NixOS/nixpkgs/pulls/{pr}" |     url = f"https://api.github.com/repos/NixOS/nixpkgs/pulls/{pr}" | ||||||
|     pr_response = requests.get(url, headers=DEFAULT_HEADERS) |     pr_response = requests.get(url, headers=DEFAULT_HEADERS) | ||||||
|     pr_response.raise_for_status() |     pr_response.raise_for_status() | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| [project] | [project] | ||||||
| name = "nixprstatus" | name = "nixprstatus" | ||||||
| version = "0.1.15" | version = "0.1.16" | ||||||
| description = "Nixpkgs PR status checker" | description = "Nixpkgs PR status checker" | ||||||
| readme = "README.md" | readme = "README.md" | ||||||
| requires-python = ">=3.12" | requires-python = ">=3.12" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user