INNER CODE UNIT · Python

catalog_affects_ios

joreilly/Confetti · .github/scripts/ios-changes.py:136

def catalog_affects_ios(base_revision: str, head_revision: str) -> tuple[bool, str]:
    try:
        accessors = relevant_catalog_accessors(catalog_at(base_revision), catalog_at(head_revision))
    except (subprocess.CalledProcessError, tomllib.TOMLDecodeError, UnicodeDecodeError) as error:
        return True, f"could not classify the version catalog safely ({error})"

    used = sorted(item for item in accessors if item in ios_build_text())
    if used:
        return True, f"version catalog changes affect iOS build inputs: {', '.join(used)}"
    return False, "version catalog changes are not referenced by iOS build inputs"


def classify(base_revision: str, head_revision: str) -> tuple[bool, str]:
    # Use the merge base so updates merged into the target branch after a PR was
    # opened are not mistaken for changes made by the PR.
    merge_base = git("merge-base", base_revision, head_revision).decode().strip()
    changed = [item.decode() for item in git("diff", "--name-only", "-z", merge_base, head_revision).split(b"\0") if item]
    if not changed:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…