Skip to content

Commit 7bc2a47

Browse files
committed
fix: simplify test workflows with conditional steps and permissions
- Merge `test` and `test-and-format` workflows into a single workflow with conditional steps for `push` and `pull_request` events. - Dynamically adjust `contents` permission to `write` for `push` and `read` for `pull_request`. - Update `actions/checkout` configuration to handle branch refs and persist credentials conditionally. - Restrict auto-formatting and commit steps to `push` events only. - Ensure `ruff format --check` runs conditionally on `pull_request` events.
1 parent f7f765e commit 7bc2a47

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

docs/generate_sensors_md.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ def build_select_rows(config) -> list[list[str]]:
181181
def build_sensor_rows(groups, derived, *, prefix: str = "") -> list[list[str]]:
182182
rows = [sensor_row(e, prefix=prefix) for e in iter_sensor_entities(groups)]
183183
rows.extend(sensor_row(e, prefix=prefix) for e in derived)
184+
184185
# Sort by first register then name
185186
def sort_key(row):
186187
regs = row[4]
@@ -210,10 +211,7 @@ def main() -> None:
210211
existing = OUT.read_text(encoding="utf-8") if OUT.exists() else ""
211212
waveshare, modes = extract_preserved_sections(existing)
212213
if not waveshare:
213-
waveshare = (
214-
"# Waveshare\n"
215-
"This is only required if your values are higher than expected, if you aren't experiencing this, this should be disabled.\n"
216-
)
214+
waveshare = "# Waveshare\nThis is only required if your values are higher than expected, if you aren't experiencing this, this should be disabled.\n"
217215
if not modes:
218216
modes = "# Solar Inverter Modes in Solis Inverters\n"
219217

@@ -226,9 +224,7 @@ def main() -> None:
226224
sensor_headers = ["Name", "Device Class", "Unit Of Measurement", "State Class", "Registers"]
227225

228226
hybrid_switch_rows = build_switch_rows(hybrid_cfg)
229-
string_switch_rows = [
230-
r for r in build_switch_rows(string_cfg) if r[1] not in {row[1] for row in hybrid_switch_rows} or "power limit" in r[0].lower()
231-
]
227+
string_switch_rows = [r for r in build_switch_rows(string_cfg) if r[1] not in {row[1] for row in hybrid_switch_rows} or "power limit" in r[0].lower()]
232228
# Avoid duplicating 90005 if present on both
233229
hybrid_names = {r[0] for r in hybrid_switch_rows}
234230
string_switch_rows = [r for r in string_switch_rows if r[0] not in hybrid_names]

0 commit comments

Comments
 (0)