GitHub app that sends an email with every commit diff
  • Go 85.1%
  • HTML 10.9%
  • Dockerfile 4%
Find a file
2026-01-15 14:12:02 -06:00
static Serve logo from embedded data 2026-01-06 11:47:41 -06:00
stats Bump everything to go-github v75 2026-01-11 12:19:14 -06:00
test-push Add -port to test-push 2026-01-07 11:27:07 -06:00
test-pushes Fix stdout emails 2026-01-08 14:25:47 -06:00
.dockerignore Tweaks to docker setup 2024-10-01 09:31:24 -05:00
.env.production Set SMTP password again 2026-01-06 15:06:10 -06:00
.env.staging Start setting up local testing 2024-11-07 12:03:38 -06:00
.gitignore Fix handling of environment variables 2024-10-01 09:27:28 -05:00
config.go Fix misuse of slog 2024-11-07 11:11:03 -06:00
create_email.go Add explicit line break between table and diff 2026-01-15 14:12:02 -06:00
docker-compose.yml Avoid warning about EMAIL_STDOUT 2024-10-02 21:59:55 -05:00
Dockerfile Install git-delta and aha from apt-get 2026-01-10 19:07:09 -06:00
git.go Bump everything to go-github v75 2026-01-11 12:19:14 -06:00
go.mod Bump everything to go-github v75 2026-01-11 12:19:14 -06:00
go.sum Bump everything to go-github v75 2026-01-11 12:19:14 -06:00
LICENSE Start separating from git-mailbot 2024-09-29 13:15:22 -05:00
mailbot.go Update TODOs 2026-01-11 12:21:45 -06:00
README.md Update TODOs 2026-01-11 12:21:45 -06:00

GitHub commit-email-bot

commit-email-bot sends emails when changes are pushed to a Git repository on Github.

Getting started

Install the commit-emails GitHub app

In your repo, commit a file called .github/commit-emails.toml that specifies the recipients and the format of the emails (the default is html, text is also supported)

to = "alice@example.com,bob@example.net"

[email]
format = "html"

Every email from commit-email-bot contains the string jD27HVpTX3tELRBjcpGsK6io7 followed by the name of the repo. You can use this to easily filter commit emails in Gmail.

Deploying

Create a Digital Ocean droplet and a volume. Clone the repo on the droplet. Mount the created volume (following Digital Ocean's instructions to get its UUID) to /root/commit-email-bot/persist.

You'll need to point the commit-emails.xyz domain to the droplet: configure NameCheap's A record to the droplet's public IPv4 address.

Install docker:

sudo apt install -y docker.io docker-compose-v2 docker-buildx

A 512MB virtual machine runs out of memory when building, but not when running, so make sure to configure some swap space:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

Copy the private key for the production secrets in .env.production:

rsync .env.keys root@commit-emails.xyz:./commit-email-bot/

Building the container on the droplet is difficult. You can build it locally and push it:

docker buildx build -t tchajed/commit-email-bot:latest . --platform linux/amd64
docker push tchajed/commit-email-bot:latest

Then pull the image and run the container:

docker pull tchajed/commit-email-bot:latest
dotenvx run -f .env.keys -- docker compose up

Future work

  • Expose a branch filter option
  • Clean up old cloned repos to free up space.
  • Upgrade to a paid Mailgun account to support a wider audience.

Acknowledgment

Based on David's git-mailbot.