Skip to content

feat: let organization admins sync their GitHub profile - #1387

Open
MrPunyapal wants to merge 1 commit into
dev-null-sh:productionfrom
MrPunyapal:feat/sync-organization-profile-from-github
Open

MrPunyapal wants to merge 1 commit into
dev-null-sh:productionfrom
MrPunyapal:feat/sync-organization-profile-from-github

Conversation

@MrPunyapal

@MrPunyapal MrPunyapal commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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

  • 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.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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 Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

@MrPunyapal
MrPunyapal force-pushed the feat/sync-organization-profile-from-github branch from 6c89c11 to ff362d8 Compare November 3, 2026 05:56
@MrPunyapal
MrPunyapal marked this pull request as ready for review November 3, 2026 06:01
@MrPunyapal
MrPunyapal force-pushed the feat/sync-organization-profile-from-github branch from ff362d8 to 560a4f8 Compare November 4, 2026 20:50
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