[Devant migration] Add private GitHub repository support for the cloud variant#750
Conversation
Implements the cloud RepositoryApi against the BFF's /git/github routes (platform GitHub App flow): installation binding from the authorize popup, per-installation repo/branch/tree listing with an owner-to- installation cache, and flat-to-nested tree conversion. Create flow sends secretRef: "" plus the githubApp source binding for private repos; the BFF persists the binding and provisions per-build clone secrets. Adds the 409 authorized-but-not-installed install-popup flow (new GITHUB_APP_SLUG runtime config, 'installing' auth status) and gates the private GitHub option on githubAppClientId.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe cloud API now supports GitHub App installations for private repository discovery, branch and tree access, authorization binding, and component creation. Runtime configuration exposes the GitHub App slug, while authentication tracks installation as a distinct state and opens the installation page when required. Import and project flows pass installation identifiers, display installation progress, and fall back to public mode when GitHub App configuration is unavailable. BFF failures now use an exported error type, and component creation logs non-fatal warnings. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
ipaas/src/pages/ImportIntegration.tsx (1)
332-339: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove unreachable loading state.
This inline loading state is unreachable because the component already performs an early return for these exact conditions (
!isPublicRepo && (authStatus === 'authenticating' || authStatus === 'installing')) at line 532. SincerenderGitHubAreais only rendered when!isPublicRepo(line 597), it will never evaluate this branch.Consider removing the dead code to simplify the render function.
♻️ Proposed refactor
return ( <Box sx={{ mb: 4 }}> - {authStatus === 'authenticating' || authStatus === 'installing' ? ( - <Stack direction="row" spacing={1.5} alignItems="center" sx={{ minHeight: 50 }}> - <CircularProgress size={16} /> - <Typography color="text.secondary" variant="body2"> - {authStatus === 'installing' ? 'Install the GitHub App in the popup, then return here…' : 'Completing GitHub authorization…'} - </Typography> - </Stack> - ) : ( - <Box> - {authStatus === 'failed' && ( - <Alert severity="error" sx={{ mb: 1.5 }}> - GitHub authorization failed. Please try again. - </Alert> - )} - <Button - variant="outlined" - startIcon={ - <Box sx={{ color: 'common.black', display: 'flex' }}> - <GitHub size={16} /> - </Box> - } - onClick={() => startGitHubAuth(refetchRepos)} - size="small"> - Authorize with GitHub - </Button> - </Box> - )} + <Box> + {authStatus === 'failed' && ( + <Alert severity="error" sx={{ mb: 1.5 }}> + GitHub authorization failed. Please try again. + </Alert> + )} + <Button + variant="outlined" + startIcon={ + <Box sx={{ color: 'common.black', display: 'flex' }}> + <GitHub size={16} /> + </Box> + } + onClick={() => startGitHubAuth(refetchRepos)} + size="small"> + Authorize with GitHub + </Button> + </Box> </Box> );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ipaas/src/pages/ImportIntegration.tsx` around lines 332 - 339, Remove the unreachable `authStatus === 'authenticating' || authStatus === 'installing'` loading branch from `renderGitHubArea`; the component’s existing early return already handles these states before this renderer is reached. Preserve the remaining GitHub area rendering behavior for all other authentication states.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ipaas/src/api/cloud/repository.ts`:
- Around line 139-154: Update the installations mapping in the user repository
fetch flow to catch errors for each installation independently, allowing
successful installations to remain in the Promise.all result. Within the
callback around the repository request, rethrow only authentication-required
errors using the existing auth-error detection behavior; otherwise log or skip
the failed installation and return an empty/omitted repository result consistent
with the surrounding API contract.
---
Nitpick comments:
In `@ipaas/src/pages/ImportIntegration.tsx`:
- Around line 332-339: Remove the unreachable `authStatus === 'authenticating'
|| authStatus === 'installing'` loading branch from `renderGitHubArea`; the
component’s existing early return already handles these states before this
renderer is reached. Preserve the remaining GitHub area rendering behavior for
all other authentication states.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 075ebe7c-ebf3-4923-9259-248d27f6c117
📒 Files selected for processing (17)
ipaas/src/api/cloud/_client.tsipaas/src/api/cloud/components.tsipaas/src/api/cloud/repository.tsipaas/src/api/contracts.tsipaas/src/components/ProjectCreate/GitProviderCards.tsxipaas/src/config/runtimeConfig.tsipaas/src/hooks/useGitHubAuth.tsipaas/src/pages/CreateIntegrationOptions.tsxipaas/src/pages/CreateProject.tsxipaas/src/pages/GitHubOAuthCallback.tsxipaas/src/pages/ImportIntegration.tsxipaas/src/pages/ImportProject.tsxipaas/src/pages/Project.tsxipaas/src/paths.tsipaas/src/types/component.tsipaas/src/types/import.tsipaas/src/types/repository.ts
Purpose
Implements the cloud RepositoryApi against the BFF's /git/github routes (platform GitHub App flow): installation binding from the authorize popup, per-installation repo/branch/tree listing with an owner-to- installation cache, and flat-to-nested tree conversion.
Create flow sends secretRef: "" plus the githubApp source binding for private repos; the BFF persists the binding and provisions per-build clone secrets. Adds the 409 authorized-but-not-installed install-popup flow (new GITHUB_APP_SLUG runtime config, 'installing' auth status) and gates the private GitHub option on githubAppClientId.
resolves https://github.com/wso2-enterprise/integration-engineering/issues/1949
Goals
Approach
User stories
Release note
Documentation
Training
Certification
Marketing
Automation tests
Security checks
Samples
Related PRs
Migrations (if applicable)
Test environment
Learning