ghtrack is a GitHub Action that automatically records the execution time of workflow runs and stores the data in the gh-pages branch. With a simple setup, maintain a detailed history of job durations through easily accessible time-series charts, helping optimize and improve workflows efficiently.
ghtrack is a powerful GitHub Action designed to track execution times for workflow runs by recording them directly into the gh-pages branch. This innovative tool applies real-time accumulation techniques similar to those used in benchmark-action/github-action-benchmark, shifting the focus from benchmark values to actual workflow and step durations.
Key Features
- Automated Time Tracking: Collects job and step durations, writing them to JSON files for each run under the
data/<track-name>/<YYYY>/<MM>/<DD>/directory structure within thegh-pagesbranch. - Dynamic Visualizations: Facilitates the display of time-series charts via a bundled
index.html, powered by Chart.js, providing a clear view of workflow performance through a user-friendly interface when GitHub Pages is activated. - Seamless Integration: Can be easily added to any workflow. If the
gh-pagesbranch is non-existent, it will create one automatically, storing each workflow's data without the need for configuration.
Usage Example
Integrate the ghtrack Action into your workflow as follows:
# .github/workflows/your-workflow.yml
name: build
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: echo "build something"
track:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write # required to push to gh-pages
actions: read # required to fetch workflow run / job APIs
steps:
- uses: hatsu38/ghtrack@main
Input Options
ghtrack comes with optional input configurations to facilitate data accumulation:
| Name | Default | Description |
|---|---|---|
github-token | ${{ github.token }} | Token for fetching workflow data and pushing updates. |
gh-pages-branch | gh-pages | Target branch for storing accumulated data. |
track-name | Workflow file basename (e.g., test) | Directory name under data/. Allows separation for different aspects of the workflow. |
File Structure on gh-pages
The files are organized within the gh-pages branch as follows:
gh-pages/
├── index.html
└── data/
├── manifest.json # workflow registry
└── <track-name>/
├── index.json # run list for this track
└── <YYYY>/<MM>/<DD>/
├── <run_id>-<attempt>.json # individual run data files
└── ...
Detailed Data Representation
The per-run JSON files provide a structured view of workflow executions:
{
"schema_version": 1,
"commit": "abc123...",
"branch": "main",
"event": "push",
"date": 1714397040000, // Unix ms
"workflow": "test",
"workflow_file": "test.yml",
"run_id": 25113290762,
"run_attempt": 1,
"total_duration_sec": 17.3,
"jobs": [
{
"name": "build",
"duration_sec": 14.2,
"status": "completed",
"conclusion": "success",
"steps": [
{ "name": "Set up job", "number": 1, "duration_sec": 0.5, "status": "completed", "conclusion": "success" }
]
}
]
}
Visualizing the Data
By enabling GitHub Pages and following simple setup steps, the generated index.html provides rich, interactive charts that summarize total durations and individual job performance. The dashboard supports both English and Japanese, based on user preferences.
For showcasing the dashboards and monitoring workflow performance, checkout the live demo here: Live demo.
Gather insights about your workflows today with ghtrack, the straightforward solution for monitoring and visualizing GitHub Actions run durations.
No comments yet.
Sign in to be the first to comment.