“Are we shipping well?” usually gets answered with a vibe. The DORA metrics answer it with four numbers: how often you deploy, how long a commit waits before it reaches production, what share of deploys break something, and how long it takes to recover when one does. You don’t need a dashboard vendor for three and a half of them. git log and gh already have the data.
This hack started from it-journey.dev’s Kaizen quest, whose whole argument is that you can’t improve what you only feel. I agree, so I measured. Then I spent longer trying to make the numbers lie than I spent getting them, because a metric you haven’t tried to break is a vibe with a decimal point.
Everything below ran on git 2.56.1 and gh 2.106.0 against this site’s own repository, bamr87/lifehacker.dev, on 2026-12-04. The lab experiments ran in throwaway repos under /tmp.
Step zero: find out what a “deploy” is in your repo
Every tutorial counts deploys with git tag or gh release list. So I counted those first:
$ git for-each-ref refs/tags --format='%(creatordate:short) %(refname:short) %(objecttype)'
2026-10-30 v0.2.0 commit
2026-10-31 v0.2.1 commit
2026-11-07 v0.2.2 commit
2026-11-18 v0.3.0 commit
That’s four releases ever, so roughly one deploy a fortnight. But this site is on GitHub Pages, and Pages deploys every merge to main. GitHub keeps a record of each deploy:
$ gh api 'repos/bamr87/lifehacker.dev/deployments?environment=github-pages&per_page=100' \
--paginate --jq '.[] | .environment' | sort | uniq -c
622 github-pages
622 deploys against 4 tags. The tag count was low by a factor of 155. Tags here mark version bumps from release-please, not deploys. If your tags mean “this went to production,” count tags. If they don’t, find the thing that does: the Deployments API, your deploy workflow’s runs, or your CD tool’s audit log. Every number after this depends on that choice.
The script
#!/usr/bin/env bash
# dora.sh OWNER/REPO SINCE(YYYY-MM-DD) [ENVIRONMENT] [DEPLOY_WORKFLOW]
# Run from inside a full (non-shallow) clone of OWNER/REPO.
set -euo pipefail
repo=$1 since=$2 env=${3:-github-pages} wf=${4:-pages-build-deployment}
deploys=$(mktemp); runs=$(mktemp); trap 'rm -f "$deploys" "$runs"' EXIT
# 1. Deployment frequency: real deploy records, not tags.
gh api "repos/$repo/deployments?environment=$env&per_page=100" --paginate \
--jq ".[] | select(.created_at >= \"$since\") | \"\(.created_at) \(.sha)\"" | sort > "$deploys"
[ -s "$deploys" ] || { echo "no deployments for environment '$env' since $since: check the name" >&2; exit 1; }
echo "deploys since $since: $(wc -l < "$deploys")"
while read -r ts _; do date -u -d "$ts" +%G-W%V; done < "$deploys" | sort | uniq -c
# 2. Lead time: each commit's author date -> the first deploy that contained it.
prev=""
while read -r ts sha; do
if [ -n "$prev" ]; then
d=$(date -u -d "$ts" +%s)
git log --no-merges --format=%at "$prev..$sha" | while read -r at; do echo $(( (d - at) / 60 )); done
fi
prev=$sha
done < "$deploys" | sort -n | awk '{a[NR]=$1} END {if (NR) printf "lead time (min): n=%d median=%d p90=%d max=%d\n", NR, a[int((NR+1)/2)], a[int(NR*0.9)], a[NR]}'
# 3 + 4. Change failure rate and time to restore, from the deploy workflow's runs.
gh run list --repo "$repo" --workflow "$wf" --branch main --limit 1000 --created ">=$since" \
--json createdAt,conclusion --jq '.[] | select(.conclusion != "cancelled") | "\(.createdAt) \(.conclusion)"' | sort > "$runs"
awk '{n++; if ($2 == "failure") f++} END {printf "change failure rate: %d/%d = %.1f%%\n", f, n, n ? 100*f/n : 0}' "$runs"
fail=""
while read -r ts c; do
s=$(date -u -d "$ts" +%s)
if [ "$c" = failure ] && [ -z "$fail" ]; then fail=$s; fi
if [ "$c" = success ] && [ -n "$fail" ]; then echo $(( (s - fail) / 60 )); fail=""; fi
done < "$runs" | sort -n | awk '{a[NR]=$1} END {if (NR) printf "time to restore (min): incidents=%d median=%d max=%d\n", NR, a[int((NR+1)/2)], a[NR]; else print "time to restore: no failed deploys to restore from"}'
It uses GNU date -d. macOS’s BSD date has no -d, so on a Mac that’s the line that breaks; install coreutils and swap in gdate. Here’s the last 30 days of this repo, in 6.3 seconds:
$ ./dora.sh bamr87/lifehacker.dev 2026-11-04
deploys since 2026-11-04: 88
4 2026-W45
4 2026-W46
7 2026-W47
37 2026-W48
36 2026-W49
lead time (min): n=128 median=66 p90=3679 max=23452
change failure rate: 0/88 = 0.0%
time to restore: no failed deploys to restore from
And since January, to get some failures into the sample:
$ ./dora.sh bamr87/lifehacker.dev 2026-01-01 | grep -v W
deploys since 2026-01-01: 622
lead time (min): n=761 median=1 p90=485 max=23452
change failure rate: 18/618 = 2.9%
time to restore (min): incidents=8 median=18 max=21523
Four numbers. Over the last 30 days, lead time has a median of 66 minutes, and 90% of commits ship within about 61 hours. The worst one waited 16 days. Since January, the pipeline has failed 18 times across 8 incidents, and the median recovery took 18 minutes. Now for why I don’t trust any of them yet.
The gauntlet
| # | What I did | What the metric said | Honest? |
|---|---|---|---|
| 1 | Counted git tags as deploys | 4 deploys, ever | ❌ low by 155× |
| 2 | Lightweight tag on a Nov 2 commit, created Dec 4 | creatordate=2026-11-02 |
❌ the deploy is backdated a month |
| 3 | Annotated tag, same commit, same day | creatordate=2026-12-04 |
✅ |
| 4 | Looped 100 one-line commits, one annotated tag each | 101 “deploys” on 2026-12-04, in 1 second | ❌ frequency faked 100× |
| 5 | Merged a 3-commit branch (Nov 2–4) on Nov 10 with --no-ff |
author dates Nov 2, 3, 4 | ✅ lead times 6–8 days |
| 6 | Same branch, merge --squash |
one commit, authored Nov 10 | ❌ lead time faked to zero |
| 7 | Same branch, rebased on Nov 10 | author dates kept, committer dates all Nov 10 | ✅ only if you read %at |
| 8 | GIT_AUTHOR_DATE=2027-01-01 git commit |
authored next year | ❌ negative lead time |
| 9 | Ran the script in a --depth 1 clone |
fatal: Invalid revision range, exit 128 |
✅ fails loudly |
| 10 | Typed environment production instead of github-pages |
0 deploys, exit 0, and a 0/88 failure rate | ❌ until I added the [ -s ] guard |
| 11 | Checked the month’s 0% failure rate against git log |
fix(home): the home page no longer scrolls sideways |
❌ see below |
Rows 2 and 4 cover deployment frequency. A lightweight tag has no date of its own, so creatordate falls back to the commit’s date. Tag last month’s commit today and the “deploy” lands last month. Use annotated tags (git tag -a) if tags are your deploy marker. Row 4 is the warning from the original brief, run for real. If someone’s bonus depends on deployment frequency, a 100-iteration loop multiplies it by 100 in a second. Nothing reached users, and the number went up anyway.
Rows 5 through 8 cover lead time, which is only as honest as the author dates. A squash merge creates a brand-new commit dated at merge time, so a branch that sat for a week reports a lead time of minutes. This repo merges with merge commits, which is the only reason its 66-minute median means anything. A rebase rewrites committer dates and keeps author dates, so the script reads %at. With %ct, every rebased branch would also report zero. Row 8 is the case where nothing went wrong: anyone can type any date. Sort the lead times and look at the minimum. A negative number means someone has a time machine or a script.
Rows 9 and 10 are the script’s own failures. actions/checkout clones with fetch-depth: 1 by default, so in CI you need fetch-depth: 0 or the range lookup dies. That failure is loud, which is fine. Row 10 was quiet. A typo in the environment name returned zero deploys and exited 0, and the failure-rate section still printed 0/88, because it reads a different API. That’s two halves of one report contradicting each other with no error. The guard line in the script exists because of row 10.
The failure the pipeline called a success
Row 11 is why this hack has its subtitle. Over the 30-day window, gh run list reported 88 successful Pages deploys, 0 failures and 12 cancelled runs. That’s a perfect month. In the same window, main picked up this commit:
$ git log --no-merges --since=2026-11-04 --format='%h %s' | grep -E '^[0-9a-f]+ fix(\(|:)'
d58fed4c fix(home): the home page no longer scrolls sideways (#835)
68d5477a fix(agencies): a Wargames refresh keeps the new URLs and produces links the site accepts
PR #835 describes a production defect: the home page was 12 pixels wider than the screen at every width, so on a phone the whole page slid sideways under your thumb. git log -G found where it came from:
$ git log --format='%h %ad %s' --date=short -G 'row g-4' -- index.md
d58fed4c 2026-11-25 fix(home): the home page no longer scrolls sideways (#835)
f879d5d2 2026-06-24 feat(home): rebuild landing page as the theme's news/magazine layout
The bug shipped on 2026-06-24 and was fixed on 2026-11-25, 154 days later. Both deploys show up in pages-build-deployment as green checkmarks. A deploy workflow can only tell you whether the build succeeded. It has no idea whether the change worked. So the CI-derived change failure rate counts broken builds. It doesn’t count broken changes, and the time to restore it reports (median 18 minutes) is the time to fix a build. A user would have measured this incident in months.
There’s no script that finds row 11 for you. The closest proxy is counting fix: and revert commits on main per deploy, which works only if your team writes Conventional Commits honestly, and then the metric is exactly as honest as the commit messages. The reliable version is boring: when something breaks in production, write down when it started and when it ended, somewhere a script can read. An incident label on an issue works, as long as it has an opened date and a closed date. Then compute the last two metrics from that record and use the pipeline numbers as a lower bound.
What the numbers measured
Look at the weekly counts again: 4, 4, 7, then 37 and 36. Nobody here started working five times harder in week 48. On 2026-11-24 the maintainer switched this repo’s content robots back on, and robots open a lot of pull requests. Deployment frequency measured a configuration change. That’s the honest use of DORA metrics: they describe a delivery system, including its bots, its merge strategy and its tag habits. Point them at a person and the person can become row 4 in about a second.
Verdict
The script survives a normal Tuesday. It gets a real deployment frequency and lead time out of gh api and git log in about six seconds, and it now fails loudly on a shallow clone or a mistyped environment. It doesn’t survive a bad Tuesday, where someone squash-merges or tags last month’s commit, unless you’ve standardised on merge commits and annotated tags. And on the Tuesday where the intern has sudo and a performance review coming up, deployment frequency goes up 100× and nothing gets better. Use it to compare your system with itself month over month. Keep the change failure rate it reports next to the number of fix: commits, and remember that row 11 was green.