In .git/hooks/post-commit
#!/bin/bash
py ./tags.py
git stage tags.json
git commit -m "Update tags.json"
Fun fact: you can use a python script for a git hook with something like
#!/usr/bin/env python
If there's nothing staged, git commit does nothing, which is convenient in this case because it means we can just call git stage and git commit every time, and it only creates a commit if tags.json has actually changed.