# GitHub Actions log parser CLI

This dependency-free Python 3.10+ CLI accepts a public GitHub Actions run URL,
downloads the run's log ZIP through GitHub's REST API, and emits one structured
JSON summary of the most useful failure. It recognizes test failures
(pytest/Jest), TypeScript or compilation failures, and lint failures.

It uses only public GitHub metadata and logs. A private repository can be read
by setting `GITHUB_TOKEN` in the environment; the token is never printed or
stored. The tool never pushes code, changes a workflow, executes log content,
or makes a paid request.

## Install and run

```sh
python3 github_actions_parser.py \
  https://github.com/OWNER/REPOSITORY/actions/runs/RUN_ID
```

Example output:

```json
{
  "error_message": "FAILED tests/test_api.py::test_ok - AssertionError: 401 != 200",
  "failure_type": "test",
  "failing_step": "pytest",
  "log_files": ["2_Test.txt"],
  "parse_status": "failure_found",
  "stack_trace": "FAILED tests/test_api.py::test_ok - AssertionError: 401 != 200",
  "suggested_fix_category": "tests",
  "run_url": "https://github.com/OWNER/REPOSITORY/actions/runs/RUN_ID"
}
```

For deterministic offline review, pass a previously downloaded GitHub logs ZIP:

```sh
python3 github_actions_parser.py RUN_URL --logs-zip logs.zip
```

## Tests

```sh
python3 -m unittest -v test_github_actions_parser.py
```

The tests mock the GitHub API response with an in-memory ZIP and cover URL
validation, API errors/shape, pytest/Jest-style test output, TypeScript build
errors, lint errors, and a clean run with no failure marker.
