You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: let organization admins sync their GitHub profile - #1387
Organization administrators can sync the organization’s GitHub profile from its settings page. The request checks that the selected GitHub profile is an organization and imports it through the existing profile importer, which preserves locally managed membership and lane-color data.
Tests
Focused Pest coverage for the organization profile sync request and controller passed (15 tests, 93 assertions).
Summary by CodeRabbit
New Features
Organization profile settings now display the organization’s name, username, bio, location, and website as read-only information.
You can sync the profile from GitHub and see when it was last synced, or whether it has not yet been synced.
The profile page includes a link to GitHub organization settings. Existing lane-color settings remain available.
Bug Fixes
Invalid or mismatched GitHub account details and sync failures no longer overwrite the organization’s profile. The page reports whether a sync succeeded or failed.
No actionable comments were generated in the recent review.
Walkthrough
The change adds an authenticated endpoint for syncing an organization’s profile from GitHub. It validates the returned account before updating the organization, reports the result to the profile page, and displays profile data and the last-sync time.
Changes: Organization profile sync
Layer / File(s)
Summary
Validate and import GitHub profile app/Actions/UpdateOrganizationProfile.php, tests/Feature/Controllers/OrganizationProfileSyncTest.php
The action fetches the GitHub account by the stored ID and validates its type, ID, and login before updating. Tests cover invalid account data, missing accounts, and GitHub errors.
Wire the authorized sync endpoint app/Http/Controllers/OrganizationProfileController.php, routes/web.php, tests/Feature/Controllers/OrganizationProfileSyncTest.php
The controller invokes the sync action and flashes a toast based on its result. The route requires authentication, validates the organization UUID, and applies throttling. Tests cover successful sync and access restrictions.
Show profile and sync status resources/js/pages/organization-profile/edit.tsx, tests/Feature/Controllers/OrganizationProfileControllerTest.php
The page displays read-only organization profile fields, a GitHub settings link, a sync form, and the last-sync status. The controller test checks the nullable ISO 8601 sync timestamp.
sequenceDiagram
participant ProfilePage
participant OrganizationProfileController
participant UpdateOrganizationProfile
participant GitHubProvider
participant UpdateOrCreateOrganization
ProfilePage->>OrganizationProfileController: Submit profile sync
OrganizationProfileController->>UpdateOrganizationProfile: Handle organization sync
UpdateOrganizationProfile->>GitHubProvider: Fetch account by stored GitHub ID
GitHubProvider-->>UpdateOrganizationProfile: Return account data
UpdateOrganizationProfile->>UpdateOrCreateOrganization: Update validated organization profile
UpdateOrCreateOrganization-->>UpdateOrganizationProfile: Return updated organization
UpdateOrganizationProfile-->>OrganizationProfileController: Return sync result
OrganizationProfileController-->>ProfilePage: Flash result and redirect back
Loading
Possibly related issues
[RFC] Orgs #938: The PR adds organization profile synchronization, which is part of the GitHub organization profile functionality described in the issue.
Possibly related PRs
dev-null-sh/dev-null.sh#1316: Introduces the Organization model and related controller and action patterns used here.
dev-null-sh/dev-null.sh#1406: Adds GitHub organization lookup through UpdateOrCreateOrganization, which this change calls after validating the stored GitHub ID.
dev-null-sh/dev-null.sh#1304: Adds the organization profile settings page and authorization that this change extends with a sync endpoint and form.
Suggested reviewers:mnapoli, xheaven
Merge Risk: Minimal · up to 560a4
The sync flow is admin-gated, validates GitHub organization identity, preserves local organization data, and reports status correctly. No merge-blocking risk was established.
Architecture risk: Low · up to 560a4
The change affects 4 systems.
Changed systems:app, tests, resources, routes
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — app (service) was modified; 2 changed files map to changed impact.
observed — tests (service) was modified; 2 changed files map to changed impact.
observed — resources (ui) was modified; 1 changed file maps to changed impact.
observed — routes (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
observed — Modified behavior in app/Actions/UpdateOrganizationProfile.php: Added UpdateOrganizationProfile with injected GitHub and organization-update services. Its handler validates the returned account’s type, ID, and login before updating; it returns whether the updated model is the supplied organization. Invalid account data returns false; HTTP client and unique-constraint exceptions are reported and return false.
observed — Modified behavior in app/Http/Controllers/OrganizationProfileController.php: Imports UpdateOrganizationProfile and RedirectResponse for the controller’s new update action.
observed — Modified behavior in app/Http/Controllers/OrganizationProfileController.php: The edit response adds githubSyncedAt, formatted from github_synced_at as ISO 8601 or null. A new update method invokes UpdateOrganizationProfile::handle, flashes a success toast when the result is true or an error toast otherwise, and redirects back.
observed — Modified behavior in resources/js/pages/organization-profile/edit.tsx: The page adds imports for GitHub profile actions, sync status formatting, time state, and a spinner. Edit now also accepts a nullable githubSyncedAt timestamp.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "feat: let organization admins sync their GitHub profile" matches the main change. The changeset adds an update route, a controller method, and an action that syncs an organization's GitHub …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "feat: let organization admins sync their GitHub profile" matches the main change. The changeset adds an update route, a controller method, and an action that syncs an organization's GitHub profile by its stored GitHub ID. The title is short, specific, and names the actor (organization admins) and the action (sync GitHub profile).
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 6 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 3f9b3051-9f22-47f2-ab68-883ebfe4f63d
Commits
Reviewing files that changed from the base of the PR and between ff362d8 and 560a4f8.
Files selected for processing: 1
routes/web.php
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Organization administrators can sync the organization’s GitHub profile from its settings page. The request checks that the selected GitHub profile is an organization and imports it through the existing profile importer, which preserves locally managed membership and lane-color data.
Tests
Focused Pest coverage for the organization profile sync request and controller passed (15 tests, 93 assertions).
Summary by CodeRabbit