Skip to content

Instantly share code, notes, and snippets.

@quad
Created January 5, 2026 06:28
Show Gist options
  • Select an option

  • Save quad/7c060afc3b9924e7afa74eeced9695e9 to your computer and use it in GitHub Desktop.

Select an option

Save quad/7c060afc3b9924e7afa74eeced9695e9 to your computer and use it in GitHub Desktop.
[DRAFT] Use a fixit robot, not a pre-commit hook

I never want anyone on my team to ever have to waste a second of their life on stupid shit like:

  • Formatting
  • Lints (with automatic fixes)

Behold! I drag something like this, from project to project. It's time I scream about it.

n.b.

  • concurrency to reduce conflicts
  • cancel-in-progress to prefer the HEAD
  • Put all your fixes in scripts/fixbot; easy to run locally

Github Branch Protection

The easy way is to treat your team like adults and allow force pushes; but, sadly, we both know that won't pass compliance.

The correct way is to create a Github Application. Eventually you'll do this because deploy keys are dangerous and storing secrets in Github Actions is negligent.

The fast way is to:

  1. Generate a SSH key for your fixbot:
    ssh-keygen -f fixbot_key -C yourname+fixbot@yourcompany.com
  2. Add the public key (fixbot_key.pub) as a Deploy Key with write access to your repository:
    https://github.com/your-org/your-repository/settings/keys
  3. Create a fixbot environment:
    https://github.com/your-org/your-repository/settings/environments
    • Deployment branches and tags: Protected branches only
    • Environment secrets:
      • DEPLOY_SSH_KEY: add the private key (fixbot_key) here!
  4. Delete fixbot_key and fixbot_key.pub
  5. Add Deploy Keys to the Bypass List for your repository's ruleset (you are using rulesets, right?):
    https://github.com/your-org/your-repository/settings/rules

Run on main or Pull Requests (PRs)?

Friends of mine set this up to run on their PRs. Combined with a squash and merge workflow, it keeps their main history tidy.

I don't.

Why?

  1. I rebase
  2. I don't want my branch to change underneath me
  3. My PR's are written to be easy to review; that means I generally aim for minimal diffs

Autoformatted code creates diffs that are larger than necessary. (TODO: examples)

You're weird

You may say I'm a dreamer, but I'm not the only one:

on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
fixbot:
environment: fixbot
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
ssh-key: ${{ secrets.DEPLOY_SSH_KEY }}
- run: scripts/fixbot
- uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "🤖 fixbot"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment