Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.

Commit bcc7867

Browse files
author
Legends11
committed
fix(ci): overlay_updates jq yerine GITHUB_EVENT_PATH JSON'undan Python ile okunuyor
jq multiline output sorununu tamamen ortadan kaldırır. Script artık overlay_file argümanı almıyor.
1 parent af232e6 commit bcc7867

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

.github/scripts/edit_pack_mcmeta.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
#!/usr/bin/env python3
22
"""
33
pack.mcmeta düzenleyici.
4-
Kullanım: edit_pack_mcmeta.py <pack_format> <supported_min> <supported_max> [overlay_file]
5-
overlay_file: her satır "<directory>=<min>:<max>" formatında
4+
Kullanım: edit_pack_mcmeta.py <pack_format> <supported_min> <supported_max>
5+
overlay_updates: GITHUB_EVENT_PATH üzerinden okunur (workflow_dispatch input).
66
"""
77

88
import json
9+
import os
910
import sys
1011

1112

1213
def main():
1314
if len(sys.argv) < 4:
14-
print("Kullanım: edit_pack_mcmeta.py <pack_format> <supported_min> <supported_max> [overlay_file]")
15+
print("Kullanım: edit_pack_mcmeta.py <pack_format> <supported_min> <supported_max>")
1516
sys.exit(1)
1617

1718
pf = int(sys.argv[1])
1819
smin = int(sys.argv[2])
1920
smax = int(sys.argv[3])
20-
overlay_file = sys.argv[4] if len(sys.argv) > 4 else None
2121

22+
# overlay_updates'i GITHUB_EVENT_PATH'ten oku (jq/heredoc sorunlarını önler)
2223
overlay_raw = ""
23-
if overlay_file:
24-
with open(overlay_file, "r", encoding="utf-8") as f:
25-
overlay_raw = f.read().strip()
24+
event_path = os.environ.get("GITHUB_EVENT_PATH", "")
25+
if event_path and os.path.exists(event_path):
26+
with open(event_path, "r", encoding="utf-8") as f:
27+
event = json.load(f)
28+
overlay_raw = event.get("inputs", {}).get("overlay_updates", "") or ""
2629

2730
with open("pack.mcmeta", "r", encoding="utf-8") as f:
2831
meta = json.load(f)
@@ -45,7 +48,7 @@ def main():
4548
print(f"pack_format : {old_pf}{pf}")
4649
print(f"supported_formats: [{old_smin}, {old_smax}] → [{smin}, {smax}]")
4750

48-
if overlay_raw:
51+
if overlay_raw.strip():
4952
entries = {e["directory"]: e for e in meta.get("overlays", {}).get("entries", [])}
5053
for line in overlay_raw.splitlines():
5154
line = line.strip()
@@ -54,7 +57,8 @@ def main():
5457
directory, fmt = line.split("=", 1)
5558
directory = directory.strip()
5659
o_min, o_max = fmt.strip().split(":", 1)
57-
o_min, o_max = int(o_min), int(o_max)
60+
o_min = int(o_min.strip())
61+
o_max = int(o_max.strip())
5862

5963
if directory in entries:
6064
old_fmt = entries[directory].get("formats", {})

.github/workflows/pack-mcmeta-editor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ jobs:
8888
echo "OK: Girdiler geçerli."
8989
9090
- name: Apply changes to pack.mcmeta
91+
env:
92+
GITHUB_EVENT_PATH: ${{ github.event_path }}
9193
run: |
92-
jq -r '.inputs.overlay_updates // ""' "$GITHUB_EVENT_PATH" > /tmp/overlay_updates.txt
9394
python3 .github/scripts/edit_pack_mcmeta.py \
9495
"${{ inputs.pack_format }}" \
9596
"${{ inputs.supported_min }}" \
96-
"${{ inputs.supported_max }}" \
97-
/tmp/overlay_updates.txt
97+
"${{ inputs.supported_max }}"
9898
9999
- name: Commit and push
100100
run: |

0 commit comments

Comments
 (0)