change to personal repos

This commit is contained in:
Christian Lempa committed 2023-09-22 19:26:30 +02:00
1 parent fdfe9d9876
commit e24a696537
4 files changed
+30 -26

No files matched your search

@@ -2,11 +2,11 @@
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Check Repos for clcreative
# @raycast.title Check all my GitHub Repos
# @raycast.mode compact
# Optional parameters:
# @raycast.icon https://avatars.githubusercontent.com/u/97734037?s=200&v=4
# @raycast.icon https://avatars.githubusercontent.com/u/28359525?v=4
# Documentation:
# @raycast.author ChristianLempa
@@ -16,6 +16,7 @@ from dotenv import load_dotenv
import os
from pathlib import Path
from github import Github
import traceback
load_dotenv()
@@ -31,7 +32,7 @@ ignored_folders = [
if __name__ == "__main__":
try:
repos = g.get_organization('clcreative').get_repos()
repos = g.get_user('christianlempa').get_repos()
missing_repos = []
if repos is not None:
@@ -51,6 +52,6 @@ if __name__ == "__main__":
print("Error: No repos found in organization")
exit(1)
except Exception as e:
print(f"{e.data['message']}")
except Exception:
traceback.format_exc()
exit(1)
@@ -2,11 +2,11 @@
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Clean orphaned Repos for clcreative
# @raycast.title Clean all my orphaned GitHub Repos
# @raycast.mode compact
# Optional parameters:
# @raycast.icon https://avatars.githubusercontent.com/u/97734037?s=200&v=4
# @raycast.icon https://avatars.githubusercontent.com/u/28359525?v=4
# @raycast.needsConfirmation true
# Documentation:
@@ -17,6 +17,7 @@ from dotenv import load_dotenv
import os
from pathlib import Path
from github import Github
import traceback
load_dotenv()
@@ -32,14 +33,14 @@ ignored_folders = [
if __name__ == "__main__":
try:
repos = g.get_organization('clcreative').get_repos()
repos = g.get_user('christianlempa').get_repos()
orphaned_repos = []
if repos is not None:
# check all repos on local workstation
# get all repos in projects folder
for repo in os.listdir(f'{ Path.home() }/projects/clcreative'):
for repo in os.listdir(f'{ Path.home() }/projects/christianlempa'):
# check if repo is not in ignored folders
if repo not in ignored_folders:
# check if repo is not in github
@@ -49,7 +50,7 @@ if __name__ == "__main__":
if len(orphaned_repos) > 0:
# delete oraphned repos
for repo in orphaned_repos:
os.system(f'rm -rf { Path.home() }/projects/clcreative/{repo}')
os.system(f'rm -rf { Path.home() }/projects/christianlempa/{repo}')
print(f"Deleted {len(orphaned_repos)} orphaned repos.")
exit(0)
else:
@@ -59,6 +60,6 @@ if __name__ == "__main__":
print("Error: No repos found in organization")
exit(1)
except Exception as e:
print(f"{e.data['message']}")
except Exception:
traceback.format_exc()
exit(1)
@@ -2,11 +2,11 @@
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Clone Repos for clcreative
# @raycast.title Clone all my GitHub Repos
# @raycast.mode compact
# Optional parameters:
# @raycast.icon https://avatars.githubusercontent.com/u/97734037?s=200&v=4
# @raycast.icon https://avatars.githubusercontent.com/u/28359525?v=4
# Documentation:
# @raycast.author ChristianLempa
@@ -17,6 +17,7 @@ import os
from pathlib import Path
from github import Github
from git import Repo
import traceback
load_dotenv()
@@ -31,11 +32,11 @@ ignored_folders = [
if __name__ == "__main__":
# Clone Repositories for clcreative
# Clone Repositories for christianlempa
# https://docs.github.com/en/rest/reference/repos#list-organization-repositories
# --
try:
repos = g.get_organization('clcreative').get_repos()
repos = g.get_user('christianlempa').get_repos()
cloned_repos = []
if repos is not None:
@@ -57,6 +58,6 @@ if __name__ == "__main__":
print("error: no repos found in organization")
exit(1)
except Exception as e:
print(f"{e.data['message']}")
except Exception:
traceback.format_exc()
exit(1)
@@ -2,11 +2,11 @@
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title List Repos for clcreative
# @raycast.title List all my GitHub Repos
# @raycast.mode fullOutput
# Optional parameters:
# @raycast.icon https://avatars.githubusercontent.com/u/97734037?s=200&v=4
# @raycast.icon https://avatars.githubusercontent.com/u/28359525?v=4
# Documentation:
# @raycast.author ChristianLempa
@@ -17,6 +17,7 @@ import os
from pathlib import Path
from github import Github
from git import Repo
import traceback
load_dotenv()
@@ -31,7 +32,7 @@ ignored_folders = [
if __name__ == "__main__":
try:
repos = g.get_organization('clcreative').get_repos()
repos = g.get_user('christianlempa').get_repos()
missing_repos = []
if repos is not None:
@@ -39,13 +40,13 @@ if __name__ == "__main__":
# set repo path on local workstation
repo_path = f'{ Path.home() }/projects/{repo.owner.login}/{repo.name}'
current_repo = Repo(f"{ Path.home() }/projects/{repo.owner.login}/{repo.name}")
# when repo is not existing
if not os.path.exists(repo_path):
missing_repos.append(repo.name)
print(f"\033[0;31m○\033[0m {repo.name}")
print(f"\033[0;31m●\033[0m {repo.name} (missing)")
else:
current_repo = Repo(f"{ Path.home() }/projects/{repo.owner.login}/{repo.name}")
# check if repo has untracked files
if current_repo.untracked_files:
print(f"\033[0;33m●\033[0m {repo.name} (untracked files)")
@@ -54,5 +55,5 @@ if __name__ == "__main__":
else:
print(f"\033[0;32m●\033[0m {repo.name}")
except Exception as e:
print(f"error: {e}")
except Exception:
traceback.format_exc()