Skip to content

fix: webhook follow-up improvements#277

Merged
coji merged 1 commit intomainfrom
fix/webhook-follow-up
Apr 6, 2026
Merged

fix: webhook follow-up improvements#277
coji merged 1 commit intomainfrom
fix/webhook-follow-up

Conversation

@coji
Copy link
Copy Markdown
Owner

@coji coji commented Apr 6, 2026

Summary

  • Remove hardcoded GitHub App slug — fetch dynamically via GET /app API with in-memory cache
  • Remove hardcoded baseURL in auth-client.ts — use relative paths for all environments
  • Fix GitHub App settings URL path (/orgs//organizations/)
  • Add ngrok host to Vite's allowedHosts for local webhook testing
  • Fix env validation: GOOGLE_CLIENT_ID/SECRETGITHUB_CLIENT_ID/SECRET
  • Add scopes semantics comment to process.server.ts
  • Rewrite README: English-only, separate PAT (Method A) and GitHub App (Method B) setup paths

Test plan

  • pnpm validate passes
  • GitHub App install flow works (redirects to correct app based on GITHUB_APP_ID)
  • GitHub App settings link opens correct URL
  • Login works without baseURL in auth-client
  • Server starts with correct env validation

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • ドキュメント

    • セットアップ手順を更新しました。GitHub App を使用した OAuth 認証の設定手順を追加しました。
    • 2 つの PR データ取り込み方法(リアルタイム更新とスケジュール済みクロール)を説明する新しいセクションを追加しました。
  • 新機能

    • OAuth プロバイダーを Google から GitHub に変更しました。

- GitHub App install URL を API (GET /app) から動的取得+メモリキャッシュ
- auth-client.ts の baseURL ハードコード除去(相対パスで動作)
- GitHub App settings URL のパス修正 (/orgs/ → /organizations/)
- vite.config.ts に ngrok ホスト許可を追加
- dotenv チェックに GITHUB_CLIENT_ID/SECRET を追加(GOOGLE系を修正)
- process.server.ts に scopes セマンティクスのコメント追加
- README を英語統一、PAT/GitHub App の2方式構成に整理

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 590f767d-80cf-4a1b-a1d9-c58947a04156

📥 Commits

Reviewing files that changed from the base of the PR and between 81b736c and 711ff6b.

📒 Files selected for processing (8)
  • README.md
  • app/libs/auth-client.ts
  • app/libs/dotenv.server.ts
  • app/routes/$orgSlug/settings/_index/+forms/integration-settings.tsx
  • app/routes/$orgSlug/settings/integration/index.tsx
  • app/services/github-octokit.server.ts
  • app/services/jobs/process.server.ts
  • vite.config.ts

📝 Walkthrough

Walkthrough

GitHubアプリのOAuth認証とWebhook統合を導入するため、環境変数スキーマをGoogle OAuthからGitHub OAuthに変更し、GitHub Appスラッグを動的に取得する機能を追加しました。既存のプロセスにはスコープが空の場合の早期リターンガード処理が追加されています。

Changes

Cohort / File(s) Summary
README文書の更新
README.md
UpFlowの説明を短縮し、GitHub AppのOAuth設定を必須化。OAuth関連の設定項目と環境変数テーブルを更新。PR データ取得の2つの方法(トークンベースのクロール vs Webhook連携)を追加説明。
認証・環境設定の変更
app/libs/auth-client.ts, app/libs/dotenv.server.ts
baseURLの環境依存構築を削除。Google OAuthからGitHub OAuthへの移行(GOOGLE_CLIENT_ID/SECRETGITHUB_CLIENT_ID/SECRET)。
GitHub App統合ロジック
app/services/github-octokit.server.ts
getGithubAppSlug() 関数を新規追加。メモリ内キャッシュ機構付きで、GitHub APIから認証済みアプリのスラッグを取得。
統合設定ルートの動的化
app/routes/$orgSlug/settings/integration/index.tsx
ローダーおよびアクションを拡張し、getGithubAppSlug() を呼び出して動的にインストール URL を構築。ハードコードされたURL ベースを削除。
UIパスの修正
app/routes/$orgSlug/settings/_index/+forms/integration-settings.tsx
GitHub インストール URL パスを /orgs/ から /organizations/ に更新。
ジョブ処理の最適化
app/services/jobs/process.server.ts
スコープ配列が空の場合に早期リターンしプロセスを短縮。
開発サーバー設定
vite.config.ts
ngrok 環境用に allowedHosts.ngrok-free.app に設定。

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant IntegrationRoute as Integration Route<br/>(Loader/Action)
    participant AppSlugService as GitHub App Slug<br/>Service
    participant GitHubAPI as GitHub REST API

    User->>IntegrationRoute: リクエスト(インストール)
    activate IntegrationRoute
    
    IntegrationRoute->>AppSlugService: getGithubAppSlug() 呼び出し
    activate AppSlugService
    
    AppSlugService->>GitHubAPI: GET /app(アプリ認証)
    activate GitHubAPI
    GitHubAPI-->>AppSlugService: { slug: "upflow-team" }
    deactivate GitHubAPI
    
    AppSlugService->>AppSlugService: キャッシュに保存
    AppSlugService-->>IntegrationRoute: slug を返却
    deactivate AppSlugService
    
    IntegrationRoute->>IntegrationRoute: 動的URL構築<br/>https://github.com/apps/{slug}/installations/new
    
    alt installGithubApp intent
        IntegrationRoute-->>User: リダイレクト
    else copyInstallUrl intent
        IntegrationRoute-->>User: installUrl をレスポンス返却
    end
    
    deactivate IntegrationRoute
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 GitHubのアプリ、スラッグを取得し
キャッシュに隠して、素早く統合
OAuthの流れ、Webhookで躍動
環境変数も整い、本番への道
Upflowよしよし、進化したね!🚀

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/webhook-follow-up

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coji coji merged commit b88839b into main Apr 6, 2026
6 checks passed
@coji coji deleted the fix/webhook-follow-up branch April 6, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant