|
| 1 | +# GitHub Actions Environment Configuration |
| 2 | + |
| 3 | +## Problem Solved |
| 4 | +The OAuth redirect was going to `localhost:3000` because the server wasn't receiving the correct `GH_REDIRECT_URI` environment variable. |
| 5 | + |
| 6 | +## Root Cause |
| 7 | +Environment variable name mismatch: |
| 8 | +- Server code expects: `GH_REDIRECT_URI` |
| 9 | +- You were using: `GITHUB_REDIRECT_URI` |
| 10 | + |
| 11 | +## Required GitHub Configuration |
| 12 | + |
| 13 | +### Secrets (Encrypted) |
| 14 | +``` |
| 15 | +GH_CLIENT_ID=Ov23liWFBY2V44492XIc |
| 16 | +GH_CLIENT_SECRET=dfbbb128f1f780f9b92196752e7017c7e1f8cc51 |
| 17 | +``` |
| 18 | + |
| 19 | +### Variables (Plain Text) |
| 20 | +``` |
| 21 | +NEXT_PUBLIC_API_URL=https://tracker-api.nesohq.org |
| 22 | +GH_REDIRECT_URI=https://tracker.nesohq.org/auth/callback |
| 23 | +CORS_ORIGIN=https://tracker.nesohq.org |
| 24 | +``` |
| 25 | + |
| 26 | +## Action Required |
| 27 | + |
| 28 | +⚠️ **You need to rename your GitHub Variable:** |
| 29 | + |
| 30 | +1. Go to: Settings → Secrets and variables → Actions → Variables |
| 31 | +2. Delete the variable named `GITHUB_REDIRECT_URI` |
| 32 | +3. Create a new variable named `GH_REDIRECT_URI` with value: `https://tracker.nesohq.org/auth/callback` |
| 33 | + |
| 34 | +## Files Updated |
| 35 | +- ✅ `server/.env` - Fixed variable name |
| 36 | +- ✅ `server/.env.example` - Updated example |
| 37 | +- ✅ `server/Dockerfile` - Updated build arg name |
| 38 | +- ✅ `.github/workflows/docker-build.yaml` - Updated to use correct variable name |
| 39 | + |
| 40 | +## Testing Locally |
| 41 | +```bash |
| 42 | +cd server |
| 43 | +docker build \ |
| 44 | + --build-arg GH_CLIENT_ID=Ov23liWFBY2V44492XIc \ |
| 45 | + --build-arg GH_CLIENT_SECRET=dfbbb128f1f780f9b92196752e7017c7e1f8cc51 \ |
| 46 | + --build-arg GH_REDIRECT_URI=https://tracker.nesohq.org/auth/callback \ |
| 47 | + --build-arg CORS_ORIGIN=https://tracker.nesohq.org \ |
| 48 | + -t server-test . |
| 49 | + |
| 50 | +docker run -p 3001:3001 server-test |
| 51 | + |
| 52 | +# Test the config endpoint |
| 53 | +curl http://localhost:3001/api/auth/config |
| 54 | +# Should return: {"client_id":"...","redirect_uri":"https://tracker.nesohq.org/auth/callback"} |
| 55 | +``` |
0 commit comments