skip github projects without sufficient perms
This commit is contained in:
parent
a758cb41ca
commit
44486f6633
|
@ -133,10 +133,18 @@ def create_project_hook(
|
||||||
|
|
||||||
|
|
||||||
def refresh_projects(github_token: str, repo_cache_file: Path) -> None:
|
def refresh_projects(github_token: str, repo_cache_file: Path) -> None:
|
||||||
repos = paginated_github_request(
|
repos = []
|
||||||
|
|
||||||
|
for repo in paginated_github_request(
|
||||||
"https://api.github.com/user/repos?per_page=100",
|
"https://api.github.com/user/repos?per_page=100",
|
||||||
github_token,
|
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:
|
with NamedTemporaryFile("w", delete=False, dir=repo_cache_file.parent) as f:
|
||||||
try:
|
try:
|
||||||
f.write(json.dumps(repos))
|
f.write(json.dumps(repos))
|
||||||
|
|
Loading…
Reference in a new issue