feat(python/robomp): implemented has_authorized_impl_event in the

- Implement `has_authorized_impl_event` in the database to retrieve historical authorization state.
- Update `_enforce_impl_authorization` to permit actions if prior events on the issue provided implementation authorization.
- Normalize maintainer logins by stripping `[bot]` suffixes and allow match-regex to ignore them.
This commit is contained in:
can1357
2026-06-21 19:18:37 +02:00
parent 4b2e4085e0
commit 24a0c8428a
10 changed files with 140 additions and 29 deletions
+4 -9
View File
@@ -89,16 +89,11 @@ def _login_matches_personal_repo_owner(
raw_type = owner.get("type")
if isinstance(raw_type, str) and raw_type:
owner_type = raw_type
if owner_type is not None and owner_type.lower() == "organization":
if owner_type is None or owner_type.lower() != "user":
return False
if owner_login:
return login.lower() == owner_login.lower()
if not isinstance(repo, str):
if not owner_login:
return False
owner, sep, _name = repo.partition("/")
if not sep or not owner:
return False
return login.lower() == owner.lower()
return login.lower() == owner_login.lower()
def _effective_association(
@@ -158,7 +153,7 @@ def extract_mention(body: str | None, bot_login: str) -> str | None:
if not login:
return None
pattern = re.compile(
rf"(?<![A-Za-z0-9_-])@{re.escape(login)}(?![A-Za-z0-9_-])",
rf"(?<![A-Za-z0-9_-])@{re.escape(login)}(?:\[bot\])?(?![A-Za-z0-9_-])",
re.IGNORECASE,
)
if not pattern.search(body):