|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <title>GitHub App Manifest Test</title> |
| 5 | + <style> |
| 6 | + body { font-family: Arial, sans-serif; max-width: 800px; margin: 50px auto; padding: 20px; } |
| 7 | + .container { background: #f6f8fa; padding: 20px; border-radius: 8px; border: 1px solid #d1d9e0; } |
| 8 | + textarea { width: 100%; height: 300px; font-family: monospace; } |
| 9 | + button { background: #2ea043; color: white; padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; } |
| 10 | + button:hover { background: #2c974b; } |
| 11 | + .warning { background: #fff3cd; border: 1px solid #ffeaa7; padding: 10px; border-radius: 4px; margin: 10px 0; } |
| 12 | + .info { background: #d1ecf1; border: 1px solid #bee5eb; padding: 10px; border-radius: 4px; margin: 10px 0; } |
| 13 | + .success { background: #d4edda; border: 1px solid #c3e6cb; padding: 10px; border-radius: 4px; margin: 10px 0; } |
| 14 | + .code-block { background: #f1f3f4; border: 1px solid #d1d5da; padding: 15px; border-radius: 6px; font-family: monospace; white-space: pre-wrap; margin: 10px 0; } |
| 15 | + .hidden { display: none; } |
| 16 | + details { margin: 10px 0; } |
| 17 | + summary { cursor: pointer; font-weight: bold; padding: 5px; } |
| 18 | + .dropdown-content { padding: 10px; background: #f8f9fa; border-radius: 4px; margin-top: 5px; } |
| 19 | + </style> |
| 20 | +</head> |
| 21 | +<body> |
| 22 | + <div class="container"> |
| 23 | + <h1>GitHub App Manifest Test</h1> |
| 24 | + |
| 25 | + <div class="info"> |
| 26 | + <strong>What happens next:</strong> |
| 27 | + <ol> |
| 28 | + <li>Start a local server (see instructions below)</li> |
| 29 | + <li>Click "Create GitHub App" below</li> |
| 30 | + <li>GitHub will redirect you to review and create the app</li> |
| 31 | + <li>After creation, GitHub redirects back with a temporary code</li> |
| 32 | + <li>The code will be automatically displayed and you can copy it</li> |
| 33 | + </ol> |
| 34 | + </div> |
| 35 | + |
| 36 | + <details> |
| 37 | + <summary>🚀 How to start local server (click to expand)</summary> |
| 38 | + <div class="dropdown-content"> |
| 39 | + <p>Before using this form, you need to serve this HTML file over HTTP. Run one of these commands in the directory containing this file:</p> |
| 40 | + <div class="code-block"> |
| 41 | +# Python 3 |
| 42 | +python3 -m http.server 8000 |
| 43 | + |
| 44 | +# Python 2 |
| 45 | +python -m SimpleHTTPServer 8000 |
| 46 | + |
| 47 | +# Node.js (if you have npx) |
| 48 | +npx http-server -p 8000 |
| 49 | + |
| 50 | +# PHP |
| 51 | +php -S localhost:8000 |
| 52 | + </div> |
| 53 | + <p>Then open: <strong>http://localhost:8000/github-app-manifest-form.html</strong></p> |
| 54 | + </div> |
| 55 | + </details> |
| 56 | + |
| 57 | + <details> |
| 58 | + <summary>⚠️ Important Notes (click to expand)</summary> |
| 59 | + <div class="dropdown-content"> |
| 60 | + <div class="warning"> |
| 61 | + <ul> |
| 62 | + <li><strong>This will create a real GitHub App!</strong> Make sure you understand what you're doing.</li> |
| 63 | + <li>The app will be created for organization 'joshjohanning-org'.</li> |
| 64 | + <li>You can delete the app later from GitHub's settings if needed.</li> |
| 65 | + <li>Make sure you're accessing this page via http://localhost:8000, not file://</li> |
| 66 | + </ul> |
| 67 | + </div> |
| 68 | + </div> |
| 69 | + </details> |
| 70 | + |
| 71 | + <!-- Success message when code is received --> |
| 72 | + <div id="success-message" class="success hidden"> |
| 73 | + <strong>Success!</strong> Received the manifest code from GitHub: |
| 74 | + <div class="code-block" id="manifest-code"></div> |
| 75 | + <p>You can now use this code with the script:</p> |
| 76 | + <div class="code-block" id="script-command"></div> |
| 77 | + </div> |
| 78 | + |
| 79 | + <form action="https://github.com/organizations/joshjohanning-org/settings/apps/new?state=abc123" method="post"> |
| 80 | + <h3>App Manifest Configuration:</h3> |
| 81 | + <textarea name="manifest" id="manifest" readonly></textarea> |
| 82 | + <br><br> |
| 83 | + <button type="submit">Create GitHub App from Manifest</button> |
| 84 | + </form> |
| 85 | + |
| 86 | + <details> |
| 87 | + <summary>📋 How to use the manifest code (click to expand)</summary> |
| 88 | + <div class="dropdown-content"> |
| 89 | + <p>Once you get the code back from GitHub, you can use it with the conversion script:</p> |
| 90 | + <div class="code-block">./create-github-app-from-manifest.sh YOUR_CODE_HERE</div> |
| 91 | + <p>Or manually with gh CLI:</p> |
| 92 | + <div class="code-block">gh api \ |
| 93 | + --method POST \ |
| 94 | + -H "Accept: application/vnd.github+json" \ |
| 95 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 96 | + /app-manifests/YOUR_CODE_HERE/conversions</div> |
| 97 | + </div> |
| 98 | + </details> |
| 99 | + </div> |
| 100 | + |
| 101 | + <script> |
| 102 | + // Determine the current URL - use localhost if we're on a local server |
| 103 | + let redirectUrl = 'http://localhost:8000/github-app-manifest-form.html'; |
| 104 | + |
| 105 | + // If we're already on a proper HTTP server, use the current location |
| 106 | + if (window.location.protocol === 'http:' || window.location.protocol === 'https:') { |
| 107 | + redirectUrl = window.location.href.split('?')[0]; // Remove any existing query params |
| 108 | + } |
| 109 | + |
| 110 | + // Sample manifest configuration |
| 111 | + const manifest = { |
| 112 | + "name": "Test App from Manifest", |
| 113 | + "url": "https://www.example.com", |
| 114 | + "hook_attributes": { |
| 115 | + "url": "https://example.com/github/events" |
| 116 | + }, |
| 117 | + "redirect_url": redirectUrl, |
| 118 | + "callback_urls": [ |
| 119 | + redirectUrl |
| 120 | + ], |
| 121 | + "public": false, |
| 122 | + "default_permissions": { |
| 123 | + "metadata": "read", |
| 124 | + "contents": "read", |
| 125 | + "issues": "write" |
| 126 | + }, |
| 127 | + "default_events": [ |
| 128 | + "issues", |
| 129 | + "issue_comment", |
| 130 | + "push" |
| 131 | + ] |
| 132 | + }; |
| 133 | + |
| 134 | + // Populate the textarea with the manifest JSON |
| 135 | + document.getElementById('manifest').value = JSON.stringify(manifest, null, 2); |
| 136 | + |
| 137 | + // Check if we're returning from GitHub with a code |
| 138 | + window.addEventListener('load', function() { |
| 139 | + const urlParams = new URLSearchParams(window.location.search); |
| 140 | + const code = urlParams.get('code'); |
| 141 | + const state = urlParams.get('state'); |
| 142 | + |
| 143 | + if (code) { |
| 144 | + // Show success message |
| 145 | + document.getElementById('success-message').classList.remove('hidden'); |
| 146 | + document.getElementById('manifest-code').textContent = code; |
| 147 | + document.getElementById('script-command').textContent = `./create-github-app-from-manifest.sh ${code}`; |
| 148 | + |
| 149 | + // Scroll to success message |
| 150 | + document.getElementById('success-message').scrollIntoView({ behavior: 'smooth' }); |
| 151 | + } |
| 152 | + }); |
| 153 | + </script> |
| 154 | +</body> |
| 155 | +</html> |
0 commit comments