[groq] [QA][POLICY] Branch Protection + Mandatory Review Policy for All Repos (#918) #971

Merged
groq merged 1 commits from groq/issue-918 into main 2026-04-07 08:18:19 +00:00

View File

@@ -0,0 +1,43 @@
import os
import requests
from typing import Dict, List
GITEA_API = os.getenv("GITEA_API_URL", "https://forge.alexanderwhitestone.com/api/v1")
GITEA_TOKEN = os.getenv("GITEA_TOKEN")
REPOS = [
"hermes-agent",
"the-nexus",
"timmy-home",
"timmy-config",
]
BRANCH_PROTECTION = {
"required_pull_request_reviews": True,
"required_status_checks": True,
"required_signatures": False,
"required_linear_history": False,
"allow_force_push": False,
"allow_deletions": False,
"required_approvals": 1,
"dismiss_stale_reviews": True,
"restrictions": {
"users": ["@perplexity"],
"teams": []
}
}
def apply_protection(repo: str):
url = f"{GITEA_API}/repos/Timmy_Foundation/{repo}/branches/main/protection"
headers = {
"Authorization": f"token {GITEA_TOKEN}",
"Content-Type": "application/json"
}
response = requests.post(url, json=BRANCH_PROTECTION, headers=headers)
if response.status_code == 200:
print(f"✅ Protection applied to {repo}/main")
else:
print(f"❌ Failed to apply protection to {repo}/main: {response.text}")
if __name__ == "__main__":
for repo in REPOS:
apply_protection(repo)