feat(profiles): support reconciler role in migrate_profiles (Closes #687)

This commit is contained in:
2026-07-12 21:32:01 -04:00
parent 8cac50b2e7
commit c7a444eb4b
2 changed files with 66 additions and 1 deletions
+12 -1
View File
@@ -26,6 +26,12 @@ REVIEWER_DEFAULT_ALLOWED = [
"read", "review", "comment", "approve", "request_changes", "merge"
]
REVIEWER_DEFAULT_FORBIDDEN = ["branch", "commit", "push", "open_pr"]
RECONCILER_DEFAULT_ALLOWED = [
"read", "pr.close", "pr.comment", "issue.comment", "issue.close", "gitea.branch.delete"
]
RECONCILER_DEFAULT_FORBIDDEN = [
"approve", "merge", "review", "pr.create", "branch.push", "commit"
]
def infer_role(name, execution_profile):
@@ -90,9 +96,11 @@ def migrate_v1_to_v2(v1_data):
ident_name = "reviewer"
elif role == "author":
ident_name = "author"
elif role == "reconciler":
ident_name = "reconciler"
else:
role = prof.get("role")
if role not in (None, "author", "reviewer"):
if role not in (None, "author", "reviewer", "reconciler"):
raise ValueError(
f"Profile '{name}' has unsupported role {role!r}"
)
@@ -132,6 +140,9 @@ def migrate_v1_to_v2(v1_data):
elif role == "reviewer":
identity_data["allowed_operations"] = list(REVIEWER_DEFAULT_ALLOWED)
identity_data["forbidden_operations"] = list(REVIEWER_DEFAULT_FORBIDDEN)
elif role == "reconciler":
identity_data["allowed_operations"] = list(RECONCILER_DEFAULT_ALLOWED)
identity_data["forbidden_operations"] = list(RECONCILER_DEFAULT_FORBIDDEN)
else:
raise ValueError(
f"Profile '{name}' has no explicit operation lists and no "