Skip to content

Feat: apply pulled changes to running HA after sync (apply_after_pull) - #6

Merged
askb merged 1 commit into
mainfrom
feat/apply-after-pull
Jul 16, 2026
Merged

Feat: apply pulled changes to running HA after sync (apply_after_pull)#6
askb merged 1 commit into
mainfrom
feat/apply-after-pull

Conversation

@askb

@askb askb commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Problem

The add-on pulls merged PRs into /config (git pull --rebase) but never tells Home Assistant to load them. Files on disk ≠ running config, so every merged change still needs a manual Reload Automations.

Change

New option apply_after_pull (reload | restart | off, default reload). When a sync advances HEAD (a merged PR came down) and not in dry_run, the add-on applies it via the Supervisor → core API proxy:

  • reloadhomeassistant.reload_all (automations, scripts, scenes, templates, input_*) — no restart
  • restarthomeassistant.restart — for configuration.yaml integration or custom_components/ changes that aren't hot-reloadable
  • off → previous behaviour

Enables homeassistant_api so SUPERVISOR_TOKEN is accepted by the core API proxy. Only fires on real upstream change, never on no-op runs or dry-run.

Files

  • config.jsonhomeassistant_api: true, new option + schema list(reload|restart|off), version → 0.3.0
  • rootfs/app/gitops_backup.sh — read option, ha_apply() helper, capture HEAD around the pull, apply after stash-pop
  • DOCS.md, translations/en.yaml, CHANGELOG.md — document the option
  • tests/self_check.sh — static wiring asserts

Validation

  • jq empty config.json OK; bash -n + shellcheck clean; yamllint . clean
  • bash tests/self_check.shOK: all self-checks passed

Notes

  • reload_all does not apply configuration.yaml integration or custom_components/ changes — that's the restart option, documented, not a silent gap.
  • Skipped: per-domain reload / auto-detecting reload-vs-restart from changed paths. Add if the 3-way knob proves too coarse.

The add-on pulled merged PRs into /config but never told Home Assistant
to load them, so every merged change still required a manual "Reload
Automations". Files on disk were not the running config.

Add an apply_after_pull option (reload | restart | off, default reload).
When a sync advances HEAD (a merged PR came down) and not in dry_run, the
add-on calls the Home Assistant service via the Supervisor proxy:
- reload  -> homeassistant.reload_all (automations, scripts, scenes,
             templates, input_*), no restart
- restart -> homeassistant.restart (for configuration.yaml integration or
             custom_components changes that are not hot-reloadable)
- off     -> previous behaviour

Enables homeassistant_api so SUPERVISOR_TOKEN is accepted by the core API
proxy. Bumps version to 0.3.0 and adds static wiring asserts to the
self-check.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
@askb
askb merged commit 8f98597 into main Jul 16, 2026
6 checks passed
@askb
askb deleted the feat/apply-after-pull branch July 16, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant