From c7e46c47c620b9c8b48fd1e21d56408b0eeeded0 Mon Sep 17 00:00:00 2001 From: Michael Kopp Date: Thu, 10 Sep 2026 07:59:51 +0000 Subject: [PATCH] Support pinning a custom-component branch/ref in CI Add an optional 'ref' field per dependency in tests/custom_components.yaml (defaults to 'main' when omitted, so existing behavior is unchanged) and teach the installer script in ha_check.yaml to use it when building the download URL. Lets CI validate this config against an unmerged hass-template-climate branch or PR before it merges upstream, instead of only ever testing against main. Used this to validate hass-template-climate's integration/all-features branch (a staging branch combining several upstream-PR candidates plus two bugs found along the way) end-to-end against the real airflow automation before splitting those into separate upstream PRs. No functional change on master: nothing here sets 'ref', so every dependency still installs from main exactly as before. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01EG6nBkBsv5jNAzXpiBewUy --- .github/workflows/ha_check.yaml | 5 +++-- tests/custom_components.yaml | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ha_check.yaml b/.github/workflows/ha_check.yaml index e291a65..8a2c15f 100644 --- a/.github/workflows/ha_check.yaml +++ b/.github/workflows/ha_check.yaml @@ -86,8 +86,9 @@ jobs: domain = dep["domain"] name = dep.get("name", domain) owner_repo = repo.rstrip("/").removeprefix("https://github.com/") - url = f"https://github.com/{owner_repo}/archive/refs/heads/main.tar.gz" - print(f"Installing {name} ({domain}) from {repo}") + ref = dep.get("ref", "main") + url = f"https://github.com/{owner_repo}/archive/refs/heads/{ref}.tar.gz" + print(f"Installing {name} ({domain}) from {repo}@{ref}") with tempfile.TemporaryDirectory() as tmp: archive = os.path.join(tmp, "component.tar.gz") urllib.request.urlretrieve(url, archive) diff --git a/tests/custom_components.yaml b/tests/custom_components.yaml index 7062c3b..2c4bfd7 100644 --- a/tests/custom_components.yaml +++ b/tests/custom_components.yaml @@ -15,6 +15,11 @@ dependencies: - name: Template Climate domain: climate_template repository: https://github.com/mikopp/hass-template-climate + # Optional: branch to install from (defaults to "main" if omitted). + # Lets CI validate this config against an unmerged hass-template-climate + # branch/PR before it lands on main — set it temporarily on a throwaway + # branch, never on master. + # ref: some-branch-to-validate hacs: mikopp/hass-template-climate description: > Provides the climate_template platform used in packages/climate_airflow.yaml