This repository was archived by the owner on Apr 9, 2026. It is now read-only.
v2.2.6 #31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pack Format Consistency | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'pack.mcmeta' | |
| - '.github/workflows/pack-format-check.yml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'pack.mcmeta' | |
| jobs: | |
| pack-format-check: | |
| name: Pack Format Consistency | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Check pack format values are consistent | |
| run: | | |
| FAILED=0 | |
| PACK_FORMAT=$(python3 -c "import json,sys; m=json.load(open('pack.mcmeta')); print(m['pack']['pack_format'])") | |
| SUP_MIN=$(python3 -c "import json,sys; m=json.load(open('pack.mcmeta')); sf=m['pack'].get('supported_formats'); print(sf[0] if isinstance(sf,list) else sf.get('min_inclusive',''))") | |
| SUP_MAX=$(python3 -c "import json,sys; m=json.load(open('pack.mcmeta')); sf=m['pack'].get('supported_formats'); print(sf[1] if isinstance(sf,list) else sf.get('max_inclusive',''))") | |
| META_MIN=$(python3 -c "import json,sys; m=json.load(open('pack.mcmeta')); print(m['pack'].get('min_format',''))") | |
| META_MAX=$(python3 -c "import json,sys; m=json.load(open('pack.mcmeta')); print(m['pack'].get('max_format',''))") | |
| echo "pack_format : $PACK_FORMAT" | |
| echo "supported_formats: [$SUP_MIN, $SUP_MAX]" | |
| echo "min_format : $META_MIN" | |
| echo "max_format : $META_MAX" | |
| echo "" | |
| # 1. pack_format, supported_formats icinde olmali | |
| if [ -n "$SUP_MIN" ] && [ -n "$SUP_MAX" ]; then | |
| if [ "$PACK_FORMAT" -lt "$SUP_MIN" ] || [ "$PACK_FORMAT" -gt "$SUP_MAX" ]; then | |
| echo "FAIL: pack_format ($PACK_FORMAT) is outside supported_formats [$SUP_MIN, $SUP_MAX]" | |
| FAILED=1 | |
| else | |
| echo "OK: pack_format $PACK_FORMAT is within supported_formats [$SUP_MIN, $SUP_MAX]" | |
| fi | |
| fi | |
| # 2. min_format / max_format (root level) supported_formats ile eslesmeli | |
| if [ -n "$META_MIN" ] && [ -n "$SUP_MIN" ] && [ "$META_MIN" != "$SUP_MIN" ]; then | |
| echo "FAIL: root min_format ($META_MIN) != supported_formats min ($SUP_MIN)" | |
| FAILED=1 | |
| else | |
| [ -n "$META_MIN" ] && echo "OK: min_format $META_MIN matches supported_formats min" | |
| fi | |
| if [ -n "$META_MAX" ] && [ -n "$SUP_MAX" ] && [ "$META_MAX" != "$SUP_MAX" ]; then | |
| echo "FAIL: root max_format ($META_MAX) != supported_formats max ($SUP_MAX)" | |
| FAILED=1 | |
| else | |
| [ -n "$META_MAX" ] && echo "OK: max_format $META_MAX matches supported_formats max" | |
| fi | |
| # 3. Overlay aralikları supported_formats ile ortusme kontrolu | |
| echo "" | |
| echo "Overlay format ranges:" | |
| python3 << 'PYEOF' | |
| import json, sys, os | |
| with open('pack.mcmeta') as f: | |
| meta = json.load(f) | |
| failed = 0 | |
| sup = meta['pack'].get('supported_formats', []) | |
| if isinstance(sup, list): | |
| sup_min, sup_max = sup[0], sup[1] | |
| elif isinstance(sup, dict): | |
| sup_min = sup.get('min_inclusive', 0) | |
| sup_max = sup.get('max_inclusive', 9999) | |
| else: | |
| sup_min, sup_max = sup, sup | |
| for entry in meta.get('overlays', {}).get('entries', []): | |
| d = entry['directory'] | |
| fmt = entry['formats'] | |
| if isinstance(fmt, dict): | |
| o_min = fmt.get('min_inclusive', 0) | |
| o_max = fmt.get('max_inclusive', 9999) | |
| elif isinstance(fmt, list): | |
| o_min, o_max = fmt[0], fmt[1] | |
| else: | |
| # single integer (e.g. "formats": 71) | |
| o_min, o_max = fmt, fmt | |
| overlap = o_min <= sup_max and o_max >= sup_min | |
| status = "OK" if overlap else "FAIL" | |
| if not overlap: | |
| failed = 1 | |
| print(f" {status}: overlay '{d}' [{o_min}, {o_max}] " | |
| f"{'overlaps' if overlap else 'NO OVERLAP with'} supported_formats [{sup_min}, {sup_max}]") | |
| e_min = entry.get('min_format') | |
| e_max = entry.get('max_format') | |
| if e_min is not None and e_min != o_min: | |
| print(f" FAIL: overlay '{d}' entry min_format ({e_min}) != formats.min ({o_min})") | |
| failed = 1 | |
| if e_max is not None and e_max != o_max: | |
| print(f" FAIL: overlay '{d}' entry max_format ({e_max}) != formats.max ({o_max})") | |
| failed = 1 | |
| sys.exit(failed) | |
| PYEOF | |
| PY_EXIT=$? | |
| [ $PY_EXIT -ne 0 ] && FAILED=1 | |
| echo "" | |
| if [ $FAILED -ne 0 ]; then | |
| echo "FAILED: pack.mcmeta format values are inconsistent." | |
| exit 1 | |
| fi | |
| echo "PASSED: All pack format values are consistent." |