CLI tool to parse GitHub Actions run logs and extract structured failure information
Project description
gh-actions-parser
CLI tool to parse GitHub Actions run logs and extract structured failure information. Built for automated CI triage systems.
Features
- Multi-failure-type detection: Identifies test failures (pytest, Jest), build errors (TypeScript, npm), and linting errors (ESLint, pylint)
- Structured JSON output: Machine-readable output for CI pipelines and automated systems
- Human-readable reports: Color-coded terminal output for quick manual debugging
- Stack trace extraction: Automatically finds and surfaces relevant stack traces
- Fix suggestions: Category-aware fix recommendations based on failure patterns
- Handles large repos: Processes logs with 10,000+ lines efficiently via streaming line-by-line parsing
Installation
pip install gh-actions-parser
Or from source:
git clone https://github.com/DeepSeekCode/gh-actions-parser.git
cd gh-actions-parser
pip install -e .
Usage
Basic usage
# Parse a failed run
gh-parse https://github.com/owner/repo/actions/runs/1234567890
# Using an authentication token (recommended to avoid rate limits)
gh-parse https://github.com/owner/repo/actions/runs/1234567890 -t ghp_xxxx
# Using GITHUB_TOKEN environment variable
export GITHUB_TOKEN=ghp_xxxx
gh-parse https://github.com/owner/repo/actions/runs/1234567890
JSON output mode
gh-parse https://github.com/owner/repo/actions/runs/1234567890 --json
Example JSON output:
{
"run_url": "https://github.com/test/repo/actions/runs/12345",
"repository": "test/repo",
"workflow": "CI",
"conclusion": "failure",
"failing_steps": [
{
"step_name": "Run tests",
"step_number": 5,
"error_message": "AssertionError: assert 'Updated' == 'Updated Name'",
"stack_trace": "File \"tests/test_api.py\", line 42, in test_update_user\n assert result[\"name\"] == \"Updated Name\"",
"failure_category": "test_failure"
}
],
"suggested_fixes": [
"Check expected vs actual values in the assertion — the test expectation may need updating",
"Run tests locally with the same environment to reproduce the failure"
],
"error_count": 2
}
Failure Categories
| Category | Description | Example Patterns |
|---|---|---|
test_failure |
Test runner failures | pytest AssertionError, Jest expect() failures |
build_error |
Compilation or build failures | TypeScript TS errors, npm ERR!, SyntaxError |
lint_error |
Linter violations | ESLint errors, pylint E/W violations |
unknown |
Unclassified failures | Any error that doesn't match known patterns |
Supported Patterns
Test Failures
- pytest:
FAILED,AssertionError, test session summaries - Jest:
● test ›,expect().toHaveBeenCalledWith(), suite summaries - General:
FAIL,Test Suites: X failed
Build Errors
- TypeScript:
error TS2322:,Cannot find module, type errors - npm/yarn:
npm ERR!,yarn error - Python:
SyntaxError,ModuleNotFoundError,ImportError - Go:
go build.*failed
Lint Errors
- ESLint:
error path/to/file:line:col,no-console,no-undef - pylint:
E0602:,W0611: - black/prettier:
would reformat,prettier.*error
Requirements
- Python 3.10+
- GitHub personal access token (optional, but recommended)
- Without token: 60 requests/hour
- With token: 5,000 requests/hour
Development
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=gh_actions_parser
# Lint
pylint src/gh_actions_parser/
# Type check
mypy src/
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gh_actions_parser-1.0.0.tar.gz
(15.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gh_actions_parser-1.0.0.tar.gz.
File metadata
- Download URL: gh_actions_parser-1.0.0.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0861faa217a35066da14991c388de9a45f8db5a7debfc86d2f515eeb070e706e
|
|
| MD5 |
e49df05889813c3bd4521195b2c010c0
|
|
| BLAKE2b-256 |
1dd038e80d8d264720e04b55c3cb237349438385bae050828d5266d98b104a51
|
File details
Details for the file gh_actions_parser-1.0.0-py3-none-any.whl.
File metadata
- Download URL: gh_actions_parser-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
682c573a54e1ecfdc2583d544380a612564f64bec8eb2cb7f2028d59ee87adfd
|
|
| MD5 |
68271f2ed7a318f56ad484146758c76c
|
|
| BLAKE2b-256 |
63f0d7c837c78a84ee8624de1344e2e92af069710e86d60ab4662278b564e733
|