Structure: - publishing/ - version bumping and registry publishing - git/ - multi-repo git operations - config/ - package configuration utilities - lint/ - ESLint and code quality scripts - forgejo/ - Forgejo CI/CD automation (primary) - gitlab/ - DEPRECATED legacy GitLab scripts - migration/ - one-time migration utilities - templates/ - CI/CD template files - analysis/ - codebase analysis scripts - oneoffs/ - uncategorized one-time scripts Note: commits CLI will be merged into @ml/auto-commit-service Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
64 lines
2.3 KiB
Python
64 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Restore GitLab repos scheduled for deletion."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
|
|
from gitlab_npm_common import GitLabApiClient, Color
|
|
|
|
# Repos that need to be restored (they were renamed with deletion_scheduled suffix)
|
|
REPOS_TO_RESTORE = [
|
|
("eslint-config-nestjs", "eslint-config-nestjs-deletion_scheduled-77358344"),
|
|
("eslint-config-react", "eslint-config-react-deletion_scheduled-77358337"),
|
|
("typescript-config-base", "typescript-config-base-deletion_scheduled-77360606"),
|
|
("typescript-config-nestjs", "typescript-config-nestjs-deletion_scheduled-77360607"),
|
|
("typescript-config-react", "typescript-config-react-deletion_scheduled-77360608"),
|
|
("model-loader", "model-loader-deletion_scheduled-77362604"),
|
|
]
|
|
|
|
|
|
def main():
|
|
client = GitLabApiClient()
|
|
|
|
if not client.token:
|
|
print(f"{Color.RED}Error: GITLAB_TOKEN not set{Color.NC}")
|
|
sys.exit(1)
|
|
|
|
print(f"{Color.BOLD}Restoring repos from deletion...{Color.NC}\n")
|
|
|
|
for original_name, deletion_name in REPOS_TO_RESTORE:
|
|
project_path = f"TransQuinnFTW/{deletion_name}"
|
|
print(f" Restoring {original_name}...", end=" ", flush=True)
|
|
|
|
# First check if it exists with the deletion name
|
|
info = client.get_project(project_path)
|
|
if not info:
|
|
# Maybe already restored or doesn't exist
|
|
restored_info = client.get_project(f"TransQuinnFTW/{original_name}")
|
|
if restored_info and not restored_info.get("marked_for_deletion_at"):
|
|
print(f"{Color.GREEN}already restored{Color.NC}")
|
|
continue
|
|
print(f"{Color.YELLOW}not found{Color.NC}")
|
|
continue
|
|
|
|
# Try to restore
|
|
if client.restore_project(project_path):
|
|
print(f"{Color.GREEN}done{Color.NC}")
|
|
else:
|
|
print(f"{Color.RED}failed{Color.NC}")
|
|
|
|
print(f"\n{Color.BOLD}Verifying...{Color.NC}\n")
|
|
|
|
for original_name, _ in REPOS_TO_RESTORE:
|
|
project_path = f"TransQuinnFTW/{original_name}"
|
|
info = client.get_project(project_path)
|
|
if info and not info.get("marked_for_deletion_at"):
|
|
print(f" {original_name}: {Color.GREEN}OK{Color.NC}")
|
|
else:
|
|
print(f" {original_name}: {Color.RED}still pending deletion{Color.NC}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|