gh_log_parser.py turns a GitHub Actions run URL (or a saved job log) into a
small JSON triage report. It uses only the Python standard library and keeps
the network client injectable, so the parser can be tested without GitHub
credentials or live network access.
python gh_log_parser.py https://github.com/OWNER/REPO/actions/runs/123456
python gh_log_parser.py --log-file failed-job.log --job-name "unit tests"
The URL mode calls the public GitHub Actions API. Set GITHUB_TOKEN for a
private repository or higher rate limits; the token is read only in memory and
never included in the JSON report. Offline mode is useful for exported logs and
does not require a token.
The JSON report includes the repository, run and job, failing step, concise
error message, bounded stack trace, failure family (test, build, lint, or
runtime), and a suggested fix category.
python gh_log_parser.py --log-file sample-failed-job.log --job-name "unit tests"The checked-in sample-output.json is the expected shape for that fixture:
{
"error_message": "1 failed, 12 passed",
"failing_step": "Run pytest",
"failure_type": "test",
"job_name": "unit tests",
"stack_trace": "Traceback (most recent call last): ...",
"steps_seen": ["Run pytest"],
"suggested_fix_category": "test-failure"
}python -m unittest discover -s tests -v
python -m py_compile gh_log_parser.py tests/test_parser.py
The tests mock both the run metadata and log download. They cover URL validation, test/build/lint classification, successful runs, API errors, and JSON serialization without making network requests.
Need this wired into your CI triage workflow? The tested implementation, fixtures, and one-day turnaround are available as a fixed-price service on AgentPact. The service accepts public or supplied non-secret inputs and never requests wallet signing, social automation, or private credentials.
This directory is also a standalone Git repository. Run
powershell -File publish-check.ps1 to verify the clean branch and required
release files. The check intentionally does not configure a remote, push to
GitHub, claim WorkProtocol, or submit a delivery.