Created
February 6, 2025 19:38
-
-
Save guianderson/2c4362707b91dbae8ade5b0266a2b2f4 to your computer and use it in GitHub Desktop.
Revisions
-
guianderson created this gist
Feb 6, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ import requests ORG_NAME = "" TOKEN = "" # Headers para autenticação (se necessário) headers = {"Authorization": f"token {TOKEN}"} if TOKEN else {} def get_repositories(org_name): url = f"https://api.github.com/orgs/{org_name}/repos?per_page=100" response = requests.get(url, headers=headers) if response.status_code == 200: return [repo["name"] for repo in response.json()] else: print(f"Erro ao buscar repositórios: {response.json()}") return [] def get_tags(org_name, repo_name): url = f"https://api.github.com/repos/{org_name}/{repo_name}/tags" response = requests.get(url, headers=headers) if response.status_code == 200: return [tag["name"] for tag in response.json()] else: print(f"Erro ao buscar tags do repositório {repo_name}: {response.json()}") return [] def main(): repos = get_repositories(ORG_NAME) for repo in repos: print(f"📂 Repositório: {repo}") tags = get_tags(ORG_NAME, repo) if tags: for tag in tags: print(f" 🔖 {tag}") else: print(" ❌ Sem tags disponíveis") print("-" * 40) if __name__ == "__main__": main()