Try to download build-summary artifacts for faster analysis. Build-summary artifacts are small, focused files uploaded by CI containing just the error output. Much faster than downloading full logs. Returns: Path to combined summary file, or None if not availabl
(self)
| 164 | return [] |
| 165 | |
| 166 | def try_download_build_summary(self) -> Optional[Path]: |
| 167 | """Try to download build-summary artifacts for faster analysis. |
| 168 | |
| 169 | Build-summary artifacts are small, focused files uploaded by CI |
| 170 | containing just the error output. Much faster than downloading full logs. |
| 171 | |
| 172 | Returns: |
| 173 | Path to combined summary file, or None if not available |
| 174 | """ |
| 175 | try: |
| 176 | # List artifacts for this run |
| 177 | result = subprocess.run( |
| 178 | [ |
| 179 | "gh", |
| 180 | "api", |
| 181 | f"repos/{self.repo}/actions/runs/{self.run_id}/artifacts", |
| 182 | "--jq", |
| 183 | '.artifacts[] | select(.name | startswith("build-summary")) | .name', |
| 184 | ], |
| 185 | capture_output=True, |
| 186 | text=True, |
| 187 | check=True, |
| 188 | timeout=15, |
| 189 | ) |
| 190 | |
| 191 | artifact_names = [ |
| 192 | n.strip() for n in result.stdout.strip().split("\n") if n.strip() |
| 193 | ] |
| 194 | if not artifact_names: |
| 195 | print("No build-summary artifacts found for this run") |
| 196 | return None |
| 197 | |
| 198 | print(f"Found {len(artifact_names)} build-summary artifact(s)") |
| 199 | |
| 200 | # Download artifacts |
| 201 | download_dir = Path(".logs/gh/summaries") / f"run_{self.run_id}" |
| 202 | download_dir.mkdir(parents=True, exist_ok=True) |
| 203 | |
| 204 | for name in artifact_names: |
| 205 | try: |
| 206 | subprocess.run( |
| 207 | [ |
| 208 | "gh", |
| 209 | "run", |
| 210 | "download", |
| 211 | self.run_id, |
| 212 | "-n", |
| 213 | name, |
| 214 | "-D", |
| 215 | str(download_dir), |
| 216 | ], |
| 217 | capture_output=True, |
| 218 | text=True, |
| 219 | check=True, |
| 220 | timeout=30, |
| 221 | ) |
| 222 | except KeyboardInterrupt as ki: |
| 223 | handle_keyboard_interrupt(ki) |