INNER CODE UNIT · Python
replace_heading_value
Steam-Headless/docker-steam-headless · .github/scripts/manage-compatibility-report.py:75
def replace_heading_value(body, heading_names, new_value):
if not body:
return body
if isinstance(heading_names, str):
heading_names = [heading_names]
lines = body.splitlines()
targets = [f"### {h.strip().lower()}" for h in heading_names]
in_target = False
new_lines = []
for line in lines:
stripped = line.strip().lower()
if stripped in targets:
in_target = True
new_lines.append(line)
new_lines.append(new_value)