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 admins can sync the GitHub organization profile from settings. The action verifies the selected GitHub profile is an organization and uses the existing importer, which preserves locally managed membership and lane-color data.

Tests

The focused organization profile Pest tests passed: 15 tests, 93 assertions.

@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. The action validates the returned account before updating the organization. The profile page displays organization profile data and the last-sync time.

Changes: Organization profile sync

Layer / File(s) Summary
Validate and import GitHub profile
app/Actions/UpdateOrganizationProfile.php
The action fetches the GitHub account by the stored ID and validates its type, ID, and login before updating. Invalid data and handled exceptions return false.
Wire the authorized sync endpoint
app/Http/Controllers/OrganizationProfileController.php, routes/web.php, tests/Feature/Controllers/OrganizationProfileSyncTest.php
The controller invokes the action and flashes a toast based on its result. The route requires authentication, validates the organization UUID, and applies throttling. Tests cover successful sync, invalid or unavailable account data, 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 profile fields, a GitHub settings link, a sync form, and 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

Suggested reviewers: xheaven, mnapoli

Merge Risk: Minimal · up to 4f744

This adds an admin-only organization GitHub profile sync with validation and failure handling. The tests cover the main paths and no actionable merge-blocking risk was identified.

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

Check name Status Explanation
Title check Passed The title "feat: let organization admins sync their GitHub profile" matches the main change. The PR adds an admin-only action and route that sync an organization's GitHub profile from its settings pag…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "feat: let organization admins sync their GitHub profile" matches the main change. The PR adds an admin-only action and route that sync an organization's GitHub profile from its settings page, with the controller, views, and tests to support it. The title is specific and concise and does not describe anything absent from the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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: ecbb4494-54ce-4cec-b62d-470b40be20d7
Commits

Reviewing files that changed from the base of the PR and between 560a4f8 and 4f744bb.

Files selected for processing: 1

  • routes/web.php

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 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
@MrPunyapal
MrPunyapal force-pushed the feat/sync-organization-profile-from-github branch from 560a4f8 to 4f744bb Compare November 18, 2026 14:23
@MrPunyapal

Copy link
Copy Markdown
Contributor Author

@mnapoli The description now reflects the admin-only sync behavior and locally managed fields. Focused organization profile tests passed (15 tests, 93 assertions). Could you review this when you have a chance?

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