From 11bd4d214e2ce0abb7cd14d791a69e7385bd0649 Mon Sep 17 00:00:00 2001 From: Mario Guggenberger Date: Sat, 10 Jan 2026 12:50:31 +0000 Subject: [PATCH] build: extract strings sync script for local use --- .github/workflows/update-readme.yml | 14 ++------------ .ruff.toml | 1 + .vscode/tasks.json | 6 ++++++ scripts/setup-dependencies | 3 +++ scripts/sync-strings | 7 +++++++ {.github => scripts}/update-services.py | 0 {.github => scripts}/update-strings.py | 0 7 files changed, 19 insertions(+), 12 deletions(-) create mode 100755 scripts/sync-strings rename {.github => scripts}/update-services.py (100%) rename {.github => scripts}/update-strings.py (100%) diff --git a/.github/workflows/update-readme.yml b/.github/workflows/update-readme.yml index fb8fa6f4..c78a33e4 100644 --- a/.github/workflows/update-readme.yml +++ b/.github/workflows/update-readme.yml @@ -22,18 +22,8 @@ jobs: with: python-version: "3.13" - - name: Install markdown-code-runner and README code dependencies - run: | - uv pip install markdown-code-runner==2.1.0 pandas tabulate - - - name: Run markdown-code-runner - run: uv run markdown-code-runner --verbose README.md - - - name: Run update services.yaml - run: uv run python .github/update-services.py - - - name: Run update strings.json - run: uv run python .github/update-strings.py + - name: Run sync script + run: ./scripts/sync-strings - name: Commit updated README.md, strings.json, and services.yaml id: commit diff --git a/.ruff.toml b/.ruff.toml index fe94764b..8f9e5a76 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -47,6 +47,7 @@ ignore = [ "webapp/homeassistant_util_color.py" = ["ALL"] "webapp/app.py" = ["INP001", "DTZ011", "A002"] "custom_components/adaptive_lighting/homeassistant_util_color.py" = ["ALL"] +"scripts/*.py" = ["INP001"] [lint.flake8-pytest-style] fixture-parentheses = false diff --git a/.vscode/tasks.json b/.vscode/tasks.json index cd2130b2..cd2b9d8d 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,6 +12,12 @@ "type": "shell", "command": "scripts/lint", "problemMatcher": [] + }, + { + "label": "Sync strings (README, services.yaml, strings.json, etc.)", + "type": "shell", + "command": "scripts/sync-strings", + "problemMatcher": [] } ] } diff --git a/scripts/setup-dependencies b/scripts/setup-dependencies index 7722c58d..1ae05d02 100755 --- a/scripts/setup-dependencies +++ b/scripts/setup-dependencies @@ -19,3 +19,6 @@ uv pip install --upgrade mypy-dev # Workaround for aiodns/pycares compatibility issue # See: https://github.com/aio-libs/aiodns/issues/214 uv pip install --upgrade aiodns + +# README code dependencies +uv pip install markdown-code-runner==2.1.0 pandas tabulate diff --git a/scripts/sync-strings b/scripts/sync-strings new file mode 100755 index 00000000..092861d7 --- /dev/null +++ b/scripts/sync-strings @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -ex +cd "$(dirname "$0")/.." + +uv run markdown-code-runner --verbose README.md +uv run python ./scripts/update-services.py +uv run python ./scripts/update-strings.py diff --git a/.github/update-services.py b/scripts/update-services.py similarity index 100% rename from .github/update-services.py rename to scripts/update-services.py diff --git a/.github/update-strings.py b/scripts/update-strings.py similarity index 100% rename from .github/update-strings.py rename to scripts/update-strings.py