diff --git a/buildbot_nix/github_projects.py b/buildbot_nix/github_projects.py index fb8f4b0..6dfa335 100644 --- a/buildbot_nix/github_projects.py +++ b/buildbot_nix/github_projects.py @@ -133,10 +133,18 @@ def create_project_hook( def refresh_projects(github_token: str, repo_cache_file: Path) -> None: - repos = paginated_github_request( - "https://api.github.com/user/repos?per_page=100", - github_token, - ) + repos = [] + + for repo in paginated_github_request( + "https://api.github.com/user/repos?per_page=100", + github_token, + ): + if not repo["permissions"]["admin"]: + name = repo['full_name'] + log.msg(f"skipping {name} because we do not have admin privileges, needed for hook management") + else: + repos.append(repo) + with NamedTemporaryFile("w", delete=False, dir=repo_cache_file.parent) as f: try: f.write(json.dumps(repos))