My game checks your GitHub every single day. It has never read one line of your code.
That sounds like a marketing line. It's really a design constraint, because I'm exactly the kind of user who would never give a random app access to my private repos.
But there's one thing it does keep that most people wouldn't guess, and it turns out to be the most important field in the whole payload. More on that at the end.
Quick context: I'm a Java backend dev with a 9-5. On the side I build Vigilante, a free browser game where the next day of the story only opens when you push real commits to a repo you picked. (Full disclosure: I built it, so I'm biased about the game. Not about GitHub's payload format, though.)
So the game has one question to answer, every day, for every player:
Did this person do real work on their repo today?
Here's how far you can get without ever touching code.
The landlord problem
Think of it like a landlord checking whether a tenant actually lives in the flat.
The nosy landlord walks in and opens the fridge.
The decent landlord looks at the electricity meter. Lights were on at 9 pm, water ran in the morning. Someone lives here. He never needs to see what's in the fridge.
A GitHub push webhook is the electricity meter.
What GitHub actually sends you
When someone pushes, GitHub can send your server a push event. The part that matters is the commits array. Trimmed down, a commit in it looks roughly like this:
{
"id": "a1b2c3d...",
"timestamp": "2026-12-03T22:41:07+05:30",
"message": "fix login redirect loop",
"added": ["src/auth/RedirectGuard.java"],
"removed": [],
"modified": ["src/auth/LoginController.java"]
}
Notice what's missing: no diff, no file contents. You get the commit ID, when it happened, the message, and the paths that were added, removed or modified. If you want the actual changes, you have to go and ask GitHub's Commits API for them separately.
Two more details from GitHub's docs worth knowing:
- The array holds at most 2048 commits per push. Beyond that you'd need the Commits API.
- Payloads over 25 MB aren't delivered at all.
For a "did you code today" check, 2048 commits in one push is not a limit you'll hit unless something has gone very wrong in your life.
The rule I wrote for myself
Out of that payload, Vigilante keeps:
- Commit IDs, so the same commit can't be counted twice.
- Timestamps.
- File names, the paths only.
- Commit messages: only if the player opts in. By default they're dropped.
And it never asks for code or diffs. It doesn't need them.
Here's a simplified sketch of that "keep only the meter reading" step in Java. This is the idea, not a copy of production code:
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
record CommitMeta(
String id,
OffsetDateTime timestamp,
List<String> paths,
String message // null unless the player opted in
) {}
class PushSanitizer {
List<CommitMeta> sanitize(List<RawCommit> commits, boolean keepMessages) {
List<CommitMeta> out = new ArrayList<>();
for (RawCommit c : commits) {
List<String> paths = new ArrayList<>();
paths.addAll(c.added());
paths.addAll(c.removed());
paths.addAll(c.modified());
out.add(new CommitMeta(
c.id(),
OffsetDateTime.parse(c.timestamp()),
List.copyOf(paths),
keepMessages ? c.message() : null
));
}
return out; // nothing else from the payload moves forward
}
}
The important line is the boring one at the end. The sanitizer runs first, and everything after it in the pipeline only ever sees CommitMeta. If a later feature wants the commit message, it simply isn't there unless the player said yes. You can't accidentally log what you never kept.
"But commits can be faked"
Yes. This is the part every streak tracker has to face.
An empty commit takes about two seconds:
git commit --allow-empty -m "day 47"
git push
Your GitHub square goes green. Nothing was built.
So the game doesn't count every commit. Empty commits, merge commits, and commits that only touch lock files or config don't open the next day. Look at the sample payload again and you can see why an empty commit is easy to catch: its added, removed and modified arrays are all empty.
A minimal version of the "only lock files" check looks like this:
import java.util.List;
import java.util.Set;
class JunkFilter {
private static final Set<String> LOCK_FILES = Set.of(
"package-lock.json", "yarn.lock", "pnpm-lock.yaml",
"Gemfile.lock", "poetry.lock", "Cargo.lock", "go.sum"
);
boolean isEmpty(CommitMeta c) {
return c.paths().isEmpty();
}
boolean onlyLockFiles(CommitMeta c) {
return !c.paths().isEmpty() && c.paths().stream()
.map(p -> p.substring(p.lastIndexOf('/') + 1))
.allMatch(LOCK_FILES::contains);
}
}
The real list of what counts as "config only" is longer and fussier than this, and merge commits are a whole post of their own. But the shape is the point: every one of these checks runs on file names, never on file contents.
Things I had to be honest with myself about
Building a "privacy-first" thing makes it tempting to oversell. A few things I keep in mind:
1. File names are not nothing. A path like migrations/2026_12_add_payroll_table.sql says something about your project. It's much less than your code, but it isn't zero. So I don't pretend it's zero. I say it plainly: file names, yes. Code, no.
2. "We don't keep it" is a promise, not physics. GitHub sends the message text in the payload whether or not a player opted in. What makes it private is what the server chooses to drop. That's why, in the sketch above, the sanitizer is the very first step, and why I'd rather keep a step like that tiny and boring than clever.
3. Timestamps lie a little. The date inside a commit is set on the developer's own machine, so it can say whatever you want. I wrote a whole separate post about that, so short version here: it can't be the only clock you trust.
The thing it keeps
So, the field nobody guesses: file names.
Try designing the "most private" version yourself. Keep only commit IDs and timestamps. File names look like extra data you don't need, so you cut them.
Now try to write the junk-commit filter.
Without file names, you can't tell a real fix from a package-lock.json bump. You can't tell an empty commit from a real one. The most "private" version of the game would also be the easiest one to cheat, and a streak you can cheat in two seconds isn't worth much to the person keeping it.
So the field that looks most cuttable is the exact thing that keeps the streak honest. The meter reading needed one more number on it. It still never needed the fridge.
If you're building anything that hooks into GitHub, try this exercise: write down the one question your app needs answered, then cross out every field in the payload that doesn't help answer it. You'll probably end up keeping less than you expected, and one thing you didn't expect at all.
What would you cross out first?
Top comments (0)