Back to buildstats

DOCS

Quickstart

Add the buildstats-io/action@v1 step to your workflow and list one metric per line. Every push lands on a project page with history charts, README badges and a pull request comment.

Updated October 7, 2026

01

Add the step

buildstats records the numbers your build already produces. Add one step after the build and list one metric per line: the name, the value, an optional unit, and whether higher or lower is better.

.github/workflows/build.yml
name: Build on:  push:    branches: [main]  pull_request: permissions:  contents: read  id-token: write  pull-requests: write jobs:  build:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v7      - run: npm ci && npm run build      - run: echo "size=$(stat -c %s dist/app.js)" >> "$GITHUB_ENV"      - uses: buildstats-io/action@v1        with:          metrics: |            bundle_size=${{ env.size }} bytes lower            coverage=87.2 % higher

There is no API key to set up. id-token: write lets the step sign in with the workflow's GitHub OIDC token, and pull-requests: write lets it comment on pull requests. Every input is in the Action reference. Not on GitHub Actions? Push with curl and a project API key.

02

Push a commit

The first push creates the project at buildstats.io/owner/repo and stores each value against the commit. Public repositories get public projects that anyone can view, and private repositories get private projects that only members can see. The job summary links the project page.

03

Claim the project

Claiming links the project to your buildstats account and makes you its admin, so you can manage its metrics, members and API keys. Sign in with GitHub, create a claim code at buildstats.io/claim, save it as the BUILDSTATS_CLAIM repository secret, and pass it to the step:

.github/workflows/build.yml
- uses: buildstats-io/action@v1  with:    claim: ${{ secrets.BUILDSTATS_CLAIM }}    metrics: |      bundle_size=${{ env.size }} bytes lower

A code starts with bsc_, works for one repository and expires after 24 hours. The next push from that repository uses it up, and the step tells you to remove the input.

04

Put a chart in your README

Every metric has an SVG chart and a badge that follow the default branch. Wrap the chart in a picture element so it matches the reader's light or dark GitHub theme:

README.md
<a href="https://buildstats.io/acme/orbit/bundle_size"><picture>  <source media="(prefers-color-scheme: dark)"    srcset="https://buildstats.io/acme/orbit/bundle_size.svg?theme=dark">  <img alt="bundle_size" src="https://buildstats.io/acme/orbit/bundle_size.svg"></picture></a> [![bundle_size](https://buildstats.io/acme/orbit/bundle_size/badge.svg)](https://buildstats.io/acme/orbit/bundle_size)

Size, history length and branch are URL parameters, listed under charts and badges. Private projects add a token to image URLs, see private images.

05

Pull request comments

On pull_request runs the step compares each metric with the base branch and keeps one comment per project up to date, so matrix jobs share it. Metrics marked higher or lower get a better or worse verdict, and max-regression: 5 fails the check when one of them gets more than 5% worse.

Pull requests from forks get no OIDC token, so the step skips them with a notice. Fork pull requests shows the second workflow that records them.

Still have a question?Talk to us