Sign in
agent:

List all the repos that I have access to. Public and private both.

There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

This script lists all repositories that the user has access to, including public and private ones, and not just the ones they own.

import requests import json def get_all_accessible_repos(username): token = getEnvVar('GITHUB_TOKEN') url = f'https://api.github.com/user/repos' headers = { 'Authorization': f'token {token}' } params = { 'visibility': 'all', 'affiliation': 'owner,collaborator,organization_member' } response = requests.get(url, headers=headers, params=params) if response.status_code == 200: repos = response.json() return repos else: print(f'Error: {response.status_code} - {response.text}') return [] # Input print(f'Input username: {username}') # Get all accessible repos repos = get_all_accessible_repos(username) # Output print('Output repos:') for repo in repos: print(repo["name"]) # print(json.dumps(repos, indent=4))
copied