2026-07-31 09:35:03 +07:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
"""Generate GitHub App manifest URL for PR-Agent"""
|
|
|
|
|
import json
|
|
|
|
|
import base64
|
|
|
|
|
import secrets
|
|
|
|
|
|
|
|
|
|
# Generate webhook secret
|
|
|
|
|
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": {
|
2026-08-02 16:21:47 +07:00
|
|
|
"url": f"https://pr-agent.asepharyana.my.id/api/v1/github_webhooks",
|
2026-07-31 09:35:03 +07:00
|
|
|
"active": True
|
|
|
|
|
},
|
2026-08-02 16:21:47 +07:00
|
|
|
"redirect_url": "https://pr-agent.asepharyana.my.id/setup/callback",
|
|
|
|
|
"callback_urls": ["https://pr-agent.asepharyana.my.id/setup/callback"],
|
2026-07-31 09:35:03 +07:00
|
|
|
"public": False,
|
|
|
|
|
"default_events": [
|
|
|
|
|
"pull_request",
|
|
|
|
|
"issue_comment"
|
|
|
|
|
],
|
|
|
|
|
"default_permissions": {
|
|
|
|
|
"pull_requests": "write",
|
|
|
|
|
"issues": "write",
|
|
|
|
|
"contents": "read",
|
|
|
|
|
"metadata": "read",
|
|
|
|
|
"checks": "write"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Encode manifest to base64 URL-safe
|
|
|
|
|
manifest_json = json.dumps(manifest)
|
|
|
|
|
manifest_b64 = base64.urlsafe_b64encode(manifest_json.encode()).decode()
|
|
|
|
|
|
|
|
|
|
url = f"https://github.com/settings/apps/new?manifest={manifest_b64}"
|
|
|
|
|
print(f"\n{'='*60}")
|
|
|
|
|
print("MANIFEST URL (klik di browser GitHub asepharyana):")
|
|
|
|
|
print(f"{'='*60}")
|
|
|
|
|
print(url)
|
|
|
|
|
print(f"{'='*60}")
|
|
|
|
|
|
|
|
|
|
# Save for later
|
|
|
|
|
with open("/opt/pr-agent-server/manifest.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"\nManifest saved to: /opt/pr-agent-server/manifest.json")
|
|
|
|
|
print(f"Webhook secret saved to: /opt/pr-agent-server/webhook_secret.txt")
|