INNER CODE UNIT · Python

classify

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

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:
        return False, "no changed files"

    for path in changed:
        if matches(path, ALWAYS_IOS_PATHS):
            return True, f"{path} can affect the iOS build"

    catalog_changed = CATALOG_PATH in changed
    if catalog_changed:
        affects_ios, reason = catalog_affects_ios(merge_base, head_revision)
        if affects_ios:
            return True, reason

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…