()
| 518 | |
| 519 | |
| 520 | def main(): |
| 521 | parser = argparse.ArgumentParser( |
| 522 | description="Debug GitHub Actions failures efficiently", |
| 523 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 524 | epilog=""" |
| 525 | Examples: |
| 526 | %(prog)s 18397776636 |
| 527 | %(prog)s https://github.com/FastLED/FastLED/actions/runs/18397776636 |
| 528 | %(prog)s 18397776636 --max-errors 20 --context 10 |
| 529 | """, |
| 530 | ) |
| 531 | parser.add_argument("run_id", help="GitHub Actions run ID or URL") |
| 532 | parser.add_argument( |
| 533 | "--max-errors", |
| 534 | type=int, |
| 535 | default=10, |
| 536 | help="Maximum number of errors to collect (default: 10)", |
| 537 | ) |
| 538 | parser.add_argument( |
| 539 | "--context", |
| 540 | type=int, |
| 541 | default=5, |
| 542 | help="Lines of context before/after errors (default: 5)", |
| 543 | ) |
| 544 | |
| 545 | args = parser.parse_args() |
| 546 | |
| 547 | debugger = GitHubDebugger( |
| 548 | run_id=args.run_id, |
| 549 | max_errors=args.max_errors, |
| 550 | context_lines=args.context, |
| 551 | ) |
| 552 | |
| 553 | try: |
| 554 | debugger.debug() |
| 555 | except KeyboardInterrupt as ki: |
| 556 | handle_keyboard_interrupt(ki) |
| 557 | raise |
| 558 | except Exception as e: |
| 559 | print(f"\nError: {e}", file=sys.stderr) |
| 560 | sys.exit(1) |
| 561 | |
| 562 | |
| 563 | if __name__ == "__main__": |
no test coverage detected