Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for a migrator to wait for another migrator #1405

Merged
merged 2 commits into from
Jun 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions conda_forge_tick/migrators/migration_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,26 @@ def __init__(
self.bump_number = bump_number
print(self.yaml_contents)

def filter(self, attrs: "AttrsTypedDict", not_bad_str_start: str = "") -> bool:
loaded_yaml = yaml.safe_load(self.yaml_contents)
wait_for_migrators = loaded_yaml.get("__migrator", {}).get(
"wait_for_migrators",
[],
)
need_to_wait = False
if wait_for_migrators:
for migration in attrs.get("PRed", []):
if migration.get("name", "") not in wait_for_migrators:
continue
state = migration.get("PR", {}).get("state", "")
if state != "closed":
need_to_wait = True

return need_to_wait or super().filter(
attrs=attrs,
not_bad_str_start=not_bad_str_start,
)

def migrate(
self, recipe_dir: str, attrs: "AttrsTypedDict", **kwargs: Any
) -> "MigrationUidTypedDict":
Expand Down