|
| 1 | +# Orbit-btw-bot Setup Guide |
| 2 | + |
| 3 | +Follow these concise steps to set up, register, and run your GitHub App. |
| 4 | + |
| 5 | +## 1. Setup Local Webhook Proxy (Smee) |
| 6 | +GitHub needs a public URL to send events to your local machine. |
| 7 | +1. Go to [https://smee.io/](https://smee.io/) and click **"Start a new channel"**. |
| 8 | +2. Copy the **Webhook Proxy URL** (e.g., `https://smee.io/AbCdEfG...`). |
| 9 | +3. In your `orbit-bot` folder, ensure your `.env` file contains: |
| 10 | + ```env |
| 11 | + WEBHOOK_PROXY_URL=https://smee.io/your_channel_id |
| 12 | + ``` |
| 13 | + |
| 14 | +## 2. Auto-Register the App (Recommended) |
| 15 | +Probot can automatically create the App in GitHub and download its keys. |
| 16 | +1. Open your terminal in the `orbit-bot` folder and run `npm run dev`. |
| 17 | +2. Open [http://localhost:3000](http://localhost:3000) in your web browser. |
| 18 | +3. Click **"Register GitHub App"**. |
| 19 | +4. Select the **Orbit-btw** organization. |
| 20 | +5. GitHub will redirect you back, and automatically populate your `.env` file with your `APP_ID`, `PRIVATE_KEY`, and `WEBHOOK_SECRET`. |
| 21 | + |
| 22 | +*(If this works, skip to Step 4!)* |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## 3. Manual Registration (Only if Auto-Register Fails) |
| 27 | +If the button fails, you must create the App on GitHub manually. |
| 28 | +1. Go to **GitHub -> Orbit-btw (Org) -> Settings -> Developer Settings -> GitHub Apps -> New GitHub App**. |
| 29 | +2. **App Name**: `orbit-btw-bot` (must be unique). |
| 30 | +3. **Homepage URL**: `https://github.com/Orbit-btw` |
| 31 | +4. **Webhook URL**: Paste your Smee proxy URL here. |
| 32 | +5. **Webhook Secret**: Create a random password (e.g., `my_secret_123`). |
| 33 | +6. **Permissions**: |
| 34 | + - Set **Issues** to `Read & write`. |
| 35 | + - Set **Pull requests** to `Read & write`. |
| 36 | +7. **Subscribe to events**: |
| 37 | + - Check the boxes for `Issues`, `Issue comment`, and `Pull request`. |
| 38 | +8. Click **Create GitHub App**. |
| 39 | +9. On the next page, click **Generate a private key**. A `.pem` file will download to your computer. |
| 40 | +10. Update your `.env` file manually: |
| 41 | + ```env |
| 42 | + WEBHOOK_PROXY_URL=https://smee.io/your_channel_id |
| 43 | + APP_ID=123456 (Find this on the GitHub App page) |
| 44 | + WEBHOOK_SECRET=my_secret_123 |
| 45 | + PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nYourKeyHere\n-----END RSA PRIVATE KEY-----" |
| 46 | + ``` |
| 47 | +
|
| 48 | +## 4. Run and Test Locally |
| 49 | +1. Restart your server: Press `Ctrl + C` in the terminal, then run `npm run dev` again. |
| 50 | +2. Go to any issue in your GitHub repositories. |
| 51 | +3. Comment `/claim` or `/assign` on the issue. |
| 52 | +4. Your bot will automatically assign the issue to you! |
| 53 | +
|
| 54 | +## 5. Deployment (Production) |
| 55 | +Once you are ready to run the bot 24/7 without keeping your computer on: |
| 56 | +1. Push this repository to GitHub. |
| 57 | +2. Connect the repository to a hosting provider like [Render](https://render.com/). |
| 58 | +3. Set the start command to `npm start`. |
| 59 | +4. Add the following **Environment Variables** to your hosting provider (copy values from your local `.env` file): |
| 60 | + - `APP_ID` |
| 61 | + - `WEBHOOK_SECRET` |
| 62 | + - `PRIVATE_KEY` (Include the entire `-----BEGIN...` block) |
| 63 | + *(Note: You do NOT need the `WEBHOOK_PROXY_URL` variable in production)* |
| 64 | +5. **Crucial Final Step:** Once deployed, go back to your **GitHub App Settings**. Change the **Webhook URL** from your `smee.io` link to your new live URL appended with `/api/github/webhooks`. |
| 65 | + - Example: `https://your-app-name.onrender.com/api/github/webhooks` |
0 commit comments