refactor: restructure into proper project layout + improve docs
Project layout: - src/: application modules (run_server, auto_merge_bot, health-check, sync-key, trivial_merge, callback_server, start_server) - scripts/: setup/deployment helpers (setup_all, setup_app, generate_manifest) - templates/: manifest.json (GitHub App manifest template) - docs/ + CONTRIBUTING.md: documentation Improvements: - flake.nix: added pr-agent-auto-merge wrapper binary, updated installPhase paths - deploy.yml: syntax check covers all modules including health-check.py and sync-key.py - README.md: comprehensive with architecture, layout, dev, ops, deployment - CONTRIBUTING.md: standards and testing checklist - .gitignore: added *.log, *.pid, .env.* - Cleanup: removed duplicate manifest_current.json / manifest_final.json - Fix: health-check.py docstring updated to claude-opus-5 Verification: - ✅ python3 -m py_compile: all 11 modules pass - ✅ nix flake check: passes
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate GitHub App manifest with domain URL"""
|
||||
import json
|
||||
import base64
|
||||
import secrets
|
||||
|
||||
webhook_secret = secrets.token_hex(20)
|
||||
print(f"Webhook Secret: {webhook_secret}")
|
||||
|
||||
manifest = {
|
||||
"name": "pr-agent-auto-review",
|
||||
"url": "https://github.com/asepharyana",
|
||||
"hook_attributes": {
|
||||
"url": "https://pr-agent.asepharyana.my.id/api/v1/github_webhooks",
|
||||
"active": True
|
||||
},
|
||||
"redirect_url": "https://pr-agent.asepharyana.my.id/setup/callback",
|
||||
"callback_urls": ["https://pr-agent.asepharyana.my.id/setup/callback"],
|
||||
"public": False,
|
||||
"default_events": [
|
||||
"pull_request",
|
||||
"issue_comment"
|
||||
],
|
||||
"default_permissions": {
|
||||
"pull_requests": "write",
|
||||
"issues": "write",
|
||||
"contents": "read",
|
||||
"metadata": "read",
|
||||
"checks": "write"
|
||||
}
|
||||
}
|
||||
|
||||
manifest_json = json.dumps(manifest)
|
||||
manifest_b64 = base64.urlsafe_b64encode(manifest_json.encode()).decode()
|
||||
|
||||
print(f"\n{'='*60}")
|
||||
print("BUAT APP BARU - Klik link ini di browser GitHub:")
|
||||
print(f"{'='*60}")
|
||||
print(f"https://github.com/settings/apps/new?manifest={manifest_b64}")
|
||||
print(f"{'='*60}")
|
||||
|
||||
# Save
|
||||
with open("/opt/pr-agent-server/manifest_domain.json", "w") as f:
|
||||
json.dump(manifest, f, indent=2)
|
||||
with open("/opt/pr-agent-server/webhook_secret.txt", "w") as f:
|
||||
f.write(webhook_secret)
|
||||
|
||||
print(f"\nWebhook secret: {webhook_secret}")
|
||||
print(f"Webhook URL: https://pr-agent.asepharyana.my.id/api/v1/github_webhooks")
|
||||
Reference in New Issue
Block a user