Skip to content

Commit 01b6f02

Browse files
authored
Update check.py
1 parent 90cb59d commit 01b6f02

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

.github/scripts/check.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,36 @@ def main(is_daily: bool):
161161
162162
**Änderungen:** {"Text" if text_changed else ""}{" & " if (text_changed and links_changed) else ""}{"Links" if links_changed else ""}
163163
164-
**Vorher/Nachher (kompakter Text-Diff):**
164+
**Vorher/Nachher (kompakter Text-Diff):** {text_diff} {links_block}
165+
""")
166+
167+
# Snapshots immer aktualisieren (für History)
168+
html_path.write_text(new_html, encoding="utf-8")
169+
text_path.write_text(new_text, encoding="utf-8")
170+
save_json(links_path, new_links)
171+
172+
# State speichern
173+
save_json(state_dir / "monthly_counters.json", counters)
174+
save_json(state_dir / "last_run.json", last_run)
175+
176+
# Daily Summary schreiben
177+
summary = ["# ReguWatch — Daily Summary", f"Datum (UTC): {today_str()}", ""]
178+
if changes_md:
179+
summary += ["## Änderungen heute", ""] + changes_md
180+
else:
181+
summary += ["_Keine Änderungen gefunden._"]
182+
183+
(ROOT / "last_diff.txt").write_text("\n\n".join(changes_md) if changes_md else "No changes.", encoding="utf-8")
184+
(summary_dir / "daily-summary.md").write_text("\n".join(summary), encoding="utf-8")
185+
return any_changes
186+
187+
if __name__ == "__main__":
188+
parser = argparse.ArgumentParser()
189+
parser.add_argument("--daily", action="store_true", help="daily run")
190+
args = parser.parse_args()
191+
changed = main(is_daily=args.daily)
192+
gho = os.environ.get("GITHUB_OUTPUT","")
193+
if gho:
194+
with open(gho, "a") as f:
195+
f.write(("changed=1\n" if changed else "changed=0\n"))
196+
f.write("state_written=1\n")

0 commit comments

Comments
 (0)