.mise/tasks/mise-version-newer-than-main
.mise/tasks/mise-version-newer-than-mainBrowse 1970 files
275 tokens
1,221 bytes
Token encoding: o200k_base
Snapshot 21a254f
← Back to SKILL.md
1#!/usr/bin/env python32# Description: exit successfully when the pinned mise version is newer than origin/main.3 4import subprocess5import sys6from pathlib import Path7 8"""Exit successfully only when the pinned mise version is newer than origin/main.9 10`version.txt` uses dot-separated numeric versions like `2026.6.5`, so plain string11comparison is not sufficient once any segment reaches multiple digits.12 13This also prevents contributor PRs that carry an older mise version from triggering14an unnecessary image rebuild, which could fail because those image tags may not15exist in the registry.16"""17 18 19def parse_version(value: str) -> tuple[int, ...]:20 return tuple(int(part) for part in value.strip().split("."))21 22 23repo_root = subprocess.run(24 ["git", "rev-parse", "--show-toplevel"],25 capture_output=True,26 text=True,27 check=True,28).stdout.strip()29 30current = Path(repo_root, "core/mise/version.txt").read_text().strip()31result = subprocess.run(32 ["git", "show", "origin/main:core/mise/version.txt"],33 cwd=repo_root,34 capture_output=True,35 text=True,36)37main = result.stdout.strip() if result.returncode == 0 else ""38 39sys.exit(0 if not main or parse_version(current) > parse_version(main) else 1)40