Skip to main content

Compare GitHub workflow runs with detailed analysis

Project description

ghadiff

A Python CLI tool to compare two GitHub Actions workflow runs with detailed analysis of timing, status changes, and job differences.

Features

  • 🔍 Compare any two GitHub workflow runs
  • 📊 Detailed job and step-level analysis
  • ⏱️ Duration comparisons with percentage changes
  • 🎨 Multiple output formats: Text, JSON, Markdown, HTML
  • 🚀 Defaults to tenstorrent/tt-metal repository
  • 🔒 GitHub API token support with rate limit handling

Installation

From PyPI (once published)

pip install ghadiff

From source

git clone https://github.com/Aswintechie/ghadiff.git
cd ghadiff
pip install -e .

Quick Start

Prerequisites

You'll need a GitHub personal access token for API access:

  1. Go to GitHub Settings → Developer settings → Personal access tokens
  2. Generate a new token with repo and workflow scopes
  3. Set it as an environment variable:
export GITHUB_TOKEN=your_token_here

Basic Usage

Compare two workflow runs (defaults to tenstorrent/tt-metal):

ghadiff 12345678 12345679

The first argument is Run 1 (baseline), the second is Run 2 (comparison).

With Custom Repository

ghadiff 12345678 12345679 --repo owner/repo

Generate Reports

Text format (default):

ghadiff 12345678 12345679

JSON format:

ghadiff 12345678 12345679 --format json

Markdown format:

ghadiff 12345678 12345679 --format markdown -o report.md

HTML format:

ghadiff 12345678 12345679 --format html -o report.html

Output Examples

Text Format

================================================================================
GitHub Workflow Run Comparison
================================================================================

OVERVIEW
--------------------------------------------------------------------------------
Run 1: #1234 (12345678)
  Branch: main
  SHA: abc1234
  Status: completed / success
  Duration: 45.2m

Run 2: #1235 (12345679)
  Branch: main
  SHA: def5678
  Status: completed / success
  Duration: 38.7m

Duration Difference: -6.5m

JOBS COMPARISON
--------------------------------------------------------------------------------
Total jobs compared: 25
  In both runs: 25
  Only in Run 1: 0
  Only in Run 2: 0

build-and-test
   Run 1: ✅ success    - 12.3m
   Run 2: ✅ success    - 10.1m
   Diff:  -2.2m (-17.9%)

...

JSON Format

Full structured data with all workflow, job, and step details for programmatic access.

HTML Format

Beautiful, responsive HTML report with color-coded status indicators and sortable tables.

CLI Interface Example

ghadiff 12345678 12345679 \
  --repo tenstorrent/tt-metal \
  --format html \
  --output report.html

positional arguments: run1 First workflow run ID run2 Second workflow run ID

optional arguments: -h, --help show this help message and exit --repo REPO Repository in format owner/repo (default: tenstorrent/tt-metal) --token TOKEN GitHub personal access token (or use GITHUB_TOKEN env var) --format {text,json,markdown,html} Output format (default: text) --output OUTPUT, -o OUTPUT Output file (default: stdout) --verbose, -v Verbose output (text format only)


## Python API

You can also use the package programmatically:

```python
from workflow_compare import GitHubAPI, WorkflowComparator, Reporter

# Initialize API client
api = GitHubAPI(token="your_token", repo="tenstorrent/tt-metal")

# Fetch workflow runs
run1 = api.get_workflow_run_full(12345678)
run2 = api.get_workflow_run_full(12345679)

# Compare
comparator = WorkflowComparator(run1, run2)
comparison = comparator.get_full_comparison()

# Generate report
reporter = Reporter(comparison)
print(reporter.to_text())

Development

Setup Development Environment

git clone https://github.com/Aswintechie/ghadiff.git
cd ghadiff
pip install -e ".[dev]"

Run Tests

pytest

Code Formatting

black src/

Use Cases

  • Performance Regression Detection: Compare workflow runs before and after code changes
  • CI/CD Optimization: Identify which jobs got faster or slower
  • Debugging Failures: Compare a failing run with a successful baseline
  • Release Validation: Ensure new releases don't introduce timing regressions
  • Infrastructure Changes: Validate runner or environment changes

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

Links

Acknowledgments

Built for the Tenstorrent tt-metal project to improve CI/CD workflow analysis.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ghadiff-2.1.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghadiff-2.1.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file ghadiff-2.1.2.tar.gz.

File metadata

  • Download URL: ghadiff-2.1.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ghadiff-2.1.2.tar.gz
Algorithm Hash digest
SHA256 6808b1c79590c2f9a7b9d00ca0f7f7e91d9d01dd3dd68059a8e50f9611b717a2
MD5 11698e593c7990b9a1a89f35f7316218
BLAKE2b-256 bb14faac943de393a7a781c95782c7c92a9dbc4e4fc3c78ea52c0445afb9182c

See more details on using hashes here.

File details

Details for the file ghadiff-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: ghadiff-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ghadiff-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a27e55943c4f2de9d43ca3b42ac35735afcf595670063c6e9f80c06c397b03d6
MD5 9b020614f04fc4bf259610d217f244f0
BLAKE2b-256 dae2de86f63505acc911ced77563597fc2e7cc4859b9eb6b29f4f641a0c7e862

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page