nisse-review: match repository patterns against Gitea's search
At bring-up, `dev/*` failed: listing an organization's repositories (/orgs/dev/repos) needs the read:organization token scope, which the reviewer's token doesn't have and shouldn't need. Patterns are now matched against /repos/search, which needs only the repository scope and already lists every repository the account can read. A pattern that matches nothing is logged (access.no_match). owner_repositories goes. A Gitea error at startup is now reported like a config error, not a traceback. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J5Utyfzw7gF7UhjRDEtjTk
This commit is contained in:
1 parent
86f899006a
commit
faf973be6c
8 files changed
+25
-58
No files matched your search
@@ -70,8 +70,7 @@ class FakeGitea:
|
||||
comments: list[tuple[str, int, str]] = field(default_factory=list)
|
||||
refuse_off_diff: bool = False
|
||||
down: bool = False
|
||||
# Readable but not given (public): missing from /user/repos, as Gitea
|
||||
# leaves a public repository's Read collaborators out of it.
|
||||
# Readable but not given (public, no grant): missing from /user/repos.
|
||||
public: set[str] = field(default_factory=set)
|
||||
|
||||
def _up(self) -> None:
|
||||
@@ -89,13 +88,6 @@ class FakeGitea:
|
||||
self._up()
|
||||
return list(self.repos)
|
||||
|
||||
def owner_repositories(self, owner: str) -> list[str]:
|
||||
self._up()
|
||||
found = [r for r in self.repos if r.startswith(f"{owner}/")]
|
||||
if not found:
|
||||
raise GiteaNotFound(f"no owner {owner}")
|
||||
return found
|
||||
|
||||
def repository(self, repo: str) -> dict[str, Any]:
|
||||
if repo not in self.repos:
|
||||
raise GiteaNotFound(f"no repository {repo}")
|
||||
|
||||
Reference in new issue
Block a user