Return [(node_id, number, kind), ...] for issues+PRs in the repo.
(
owner: str, repo: str, include_closed: bool
)
| 254 | |
| 255 | |
| 256 | def fetch_repo_items( |
| 257 | owner: str, repo: str, include_closed: bool |
| 258 | ) -> list[tuple[str, int, str]]: |
| 259 | """Return [(node_id, number, kind), ...] for issues+PRs in the repo.""" |
| 260 | out: list[tuple[str, int, str]] = [] |
| 261 | state_flag = "all" if include_closed else "open" |
| 262 | for kind, cmd in [("issue", "issue"), ("pr", "pr")]: |
| 263 | raw = run_gh( |
| 264 | [ |
| 265 | cmd, |
| 266 | "list", |
| 267 | "--repo", |
| 268 | f"{owner}/{repo}", |
| 269 | "--state", |
| 270 | state_flag, |
| 271 | "--limit", |
| 272 | "1000", |
| 273 | "--json", |
| 274 | "id,number", |
| 275 | ] |
| 276 | ) |
| 277 | items = json.loads(raw) if raw.strip() else [] |
| 278 | for i in items: |
| 279 | out.append((str(i["id"]), int(i["number"]), kind)) |
| 280 | return out |
| 281 | |
| 282 | |
| 283 | def add_to_project(project_id: str, content_id: str) -> str | None: |