refactor: improve manifest.json generation and update check for changes

This commit is contained in:
2026-02-01 13:39:40 +00:00
parent bba19f3893
commit c6393ed472

View File

@@ -57,7 +57,9 @@ jobs:
run: | run: |
MAIN_FILE="${{ inputs.main_file }}" MAIN_FILE="${{ inputs.main_file }}"
python3 - <<'PY' python3 - <<'PY'
import json, re, os import json, os, re
from pathlib import Path
main_file = os.environ["MAIN_FILE"] main_file = os.environ["MAIN_FILE"]
with open(main_file, "r", encoding="utf-8") as handle: with open(main_file, "r", encoding="utf-8") as handle:
@@ -78,9 +80,13 @@ jobs:
"author_url": read_field("Author URI"), "author_url": read_field("Author URI"),
} }
with open("manifest.json", "w", encoding="utf-8") as handle: output = json.dumps(manifest, ensure_ascii=False, indent=2)
json.dump(manifest, handle, ensure_ascii=False, indent=2) path = Path("manifest.json")
if path.exists() and path.read_text(encoding="utf-8") == output:
print("manifest.json ongewijzigd")
else:
path.write_text(output, encoding="utf-8")
print("manifest.json aangemaakt/bijgewerkt") print("manifest.json aangemaakt/bijgewerkt")
PY PY
env: env:
@@ -88,7 +94,7 @@ jobs:
- name: Commit & push manifest.json (optioneel) - name: Commit & push manifest.json (optioneel)
run: | run: |
if git diff --quiet -- manifest.json; then if ! git status --short -- manifest.json | grep -q .; then
echo "manifest.json ongewijzigd; geen commit nodig." echo "manifest.json ongewijzigd; geen commit nodig."
exit 0 exit 0
fi fi