https://github.com/netlify/delta-action
A GitHub Action for capturing benchmark data and tracking its variation against a baseline
https://github.com/netlify/delta-action
Last synced: about 2 months ago
JSON representation
A GitHub Action for capturing benchmark data and tracking its variation against a baseline
- Host: GitHub
- URL: https://github.com/netlify/delta-action
- Owner: netlify
- License: mit
- Created: 2021-04-07T09:07:08.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-18T03:12:29.000Z (7 months ago)
- Last Synced: 2025-04-14T22:37:33.639Z (2 months ago)
- Language: JavaScript
- Size: 2.74 MB
- Stars: 18
- Watchers: 3
- Forks: 3
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Delta Action
A GitHub Action for reporting benchmark data and comparing it against a baseline.
## The basics
This action reads benchmark metrics on GitHub pull requests and commits, and reports them by adding a comment with any
metrics found. It also compares then against the latest commit on the main branch, treating it as the baseline.The action looks for benchmark data in files on the repository root. These should be named in the format
`.delta.` — e.g. `.delta.install_time` will create a metric called `install_time`.These files should contain:
- A number representing the value of the metric
- The units of the metric (optional)
- A human-friendly name of the metric (optional)_Example: `.delta.install_time`_
```
350ms (Installation time)
```The units will determine how the values will be formatted in the benchmark reports. Supported units are:
- Time (formatted with [`pretty-ms`](https://www.npmjs.com/package/pretty-ms))
- `ms` / `milliseconds`
- `s` / `seconds`
- Storage (formatted with [`pretty-bytes`](https://www.npmjs.com/package/pretty-bytes))
- `b` / `bytes`
- `kb` / `kilobytes`
- Unitless (formatted with
[`Number.prototype.toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString))## Configuration
The action supports the following optional inputs:
| Name | Description | Default |
| ------------- | ------------------------------------------------------------------------- | ------------- |
| `base_branch` | Name of the base branch, if not auto detected | autodetect |
| `title` | Title/heading to include in the comments | Delta results |
| `token` | GitHub access token | GITHUB_TOKEN |
| `pr_number` | The PR this run is associated with (for `workflow_run`) | autodetect |
| `style` | The rendering style to use when commenting on PRs (options: text, graph) | graph |## Usage
1. Add a benchmark step to your workflow that creates a `.delta.` file with the format described above
```yaml
- name: Run benchmark
run: echo 123ms > .delta.install_time
```2. Add the action to the workflow
```yaml
- name: Delta
uses: netlify/delta-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
```## Contributors
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for instructions on how to set up and work on this repository. Thanks
for contributing!