Scripts to bootstrap a Home Assistant configuration repo (a separate
repo from this one - your automations.yaml/packages/ tree, e.g. an
ha-installation-* repo, most likely the one the Git Pull add-on deploys
from) with the baseline hygiene discussed in
docs/AUTOMATION_TESTING_DESIGN.md.
Not the same repo as that design's proposed mirror repo - the mirror is
a separate, dedicated, private repo written only by ha_dev_tools itself;
these scripts have nothing to do with it.
They're standalone shell scripts with no dependency on this integration at runtime - copy them, or run them straight out of a clone of this repo, against any HA config repo.
Branch protection / rulesets - the server-enforced "no direct push to main, require review" control - is gated behind GitHub Pro (or making the repo public) for private repositories. Confirmed directly against the GitHub API for a private repo on the Free plan:
"Upgrade to GitHub Pro or make this repository public to enable this feature."
If you're not paying for Pro and want to keep the repo private (the common case for a HA config - it reveals your entity inventory, network layout, presence patterns), there's no server-side enforced gate available. These scripts are the best available compensating controls in that situation, not a full replacement for one - see each script's own caveats below before relying on it.
setup-gitignore.sh [path]- ensures.gitignoreexcludessecrets.yamland other sensitive/noisy files, and drops asecrets.yaml.exampletemplate next to it. Warns (doesn't auto-fix) ifsecrets.yamlis already tracked by git - fixing that needs history rewriting plus rotating every credential that was ever in the file, which is destructive and deliberately out of scope for an idempotent setup script.install-pre-push-guard.sh [path]- installs a local git hook that refusesgit pushdirectly tomain/masterunless you explicitly setHA_DEV_TOOLS_ALLOW_DIRECT_PUSH=1. Client-side only: it protects you from your own muscle memory, not from a compromised or malicious push from elsewhere - it's bypassable with--no-verifyand only applies to clones that ran this script.setup-ci.sh [path]- scaffolds two GitHub Actions workflows into.github/workflows/:secret-scan.yml(gitleaks, catches a committed secret even if it slipped past.gitignore) andvalidate-config.yml(yamllintplus a realcheck_configrun againstsecrets.yaml.example, since the realsecrets.yamlis gitignored and never reaches CI).
All three take the target repo's path as an optional argument (default: current directory), are idempotent, and never overwrite a file they didn't create themselves.
./setup-gitignore.sh ~/path/to/your-ha-config-repo
./install-pre-push-guard.sh ~/path/to/your-ha-config-repo
./setup-ci.sh ~/path/to/your-ha-config-repo
Then review the diff, commit on a branch, and open a PR as usual.