[Feat] GitHub App Provider#1089
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds GitHub App-based source control registration and installation management to Vito, including admin UI, provider integration, webhook handling, sync automation, persistence, and tests.
Changes:
- Adds GitHub App model, migrations, actions, provider, admin controller/page, webhook controller, and scheduled sync command.
- Updates source control registration, validation, policies, resources, and UI to account for GitHub App installations.
- Adds tests covering setup, install import, sync, webhook handling, and source-control protections.
Reviewed changes
Copilot reviewed 35 out of 37 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
tests/Feature/GithubAppTest.php |
Adds feature coverage for GitHub App flows. |
resources/js/types/source-control.d.ts |
Adds GitHub App source-control metadata types. |
resources/js/types/index.d.ts |
Extends shared config typings for GitHub App/source-control flags. |
resources/js/pages/source-controls/index.tsx |
Adds GitHub App install entry point to source controls page. |
resources/js/pages/source-controls/components/connect-source-control.tsx |
Filters non-connectable providers from manual connect UI. |
resources/js/pages/source-controls/components/columns.tsx |
Adjusts edit/delete/manage actions for GitHub App source controls. |
resources/js/pages/github-app/index.tsx |
Adds admin UI for automatic/manual GitHub App setup and management. |
resources/js/layouts/admin/layout.tsx |
Adds GitHub App admin navigation item. |
resources/js/components/copyable-field.tsx |
Adds reusable copy-to-clipboard field. |
database/migrations/2026_05_16_095752_add_external_identifier_to_source_controls_table.php |
Adds external identifier for provider-managed source controls. |
database/migrations/2026_05_16_095532_create_github_app_table.php |
Adds persisted GitHub App configuration table. |
database/factories/SourceControlFactory.php |
Adds GitHub App source-control factory state. |
database/factories/GithubAppFactory.php |
Adds GitHub App factory. |
app/SourceControlProviders/GithubApp.php |
Adds GitHub App source-control provider implementation. |
app/Providers/SourceControlServiceProvider.php |
Registers GitHub App source-control provider. |
app/Policies/SourceControlPolicy.php |
Prevents deleting GitHub App source controls through standard policy. |
app/Plugins/RegisterSourceControl.php |
Adds connectable/site-usable provider flags. |
app/Models/SourceControl.php |
Adds GitHub App provider constant and external identifier support. |
app/Models/GithubApp.php |
Adds GitHub App model with encrypted secrets. |
app/Http/Resources/SourceControlResource.php |
Exposes GitHub App source-control metadata. |
app/Http/Middleware/VerifyCsrfToken.php |
Excludes GitHub App webhook endpoint from CSRF. |
app/Http/Middleware/HandleInertiaRequests.php |
Shares GitHub App installed state with frontend. |
app/Http/Controllers/SourceControlController.php |
Routes GitHub App source-control edits to specialized action. |
app/Http/Controllers/API/SourceControlController.php |
Handles GitHub App edits in deprecated project-scoped API. |
app/Http/Controllers/API/GithubAppWebhookController.php |
Adds GitHub App webhook handling and signature verification. |
app/Http/Controllers/Admin/GithubAppController.php |
Adds admin routes for setup, install callback, sync, and removal. |
app/Console/Kernel.php |
Schedules GitHub App installation sync. |
app/Console/Commands/SyncGithubAppInstallationsCommand.php |
Adds CLI sync command. |
app/Actions/SourceControl/EditSourceControl.php |
Makes project association more nullable-safe. |
app/Actions/SourceControl/DeleteSourceControl.php |
Blocks standard deletion of GitHub App source controls. |
app/Actions/SourceControl/ConnectSourceControl.php |
Validates only connectable providers for manual source-control creation. |
app/Actions/GithubApp/SyncGithubAppInstallations.php |
Adds remote/local installation reconciliation. |
app/Actions/GithubApp/RemoveGithubApp.php |
Adds GitHub App removal workflow. |
app/Actions/GithubApp/ImportGithubAppInstallation.php |
Adds installation import/restore logic. |
app/Actions/GithubApp/EditGithubAppSourceControl.php |
Adds GitHub App source-control project-scope editing. |
app/Actions/GithubApp/CreateGithubAppManually.php |
Adds manual GitHub App creation action. |
app/Actions/GithubApp/CreateGithubAppFromManifest.php |
Adds manifest conversion creation action. |
Comments suppressed due to low confidence (2)
app/Http/Controllers/Admin/GithubAppController.php:178
- The manifest only subscribes the app to
push, but this PR's webhook controller relies oninstallationandinstallation_repositoriesevents to import, delete, suspend, and bust repository caches. Apps created through the automatic flow will not receive those lifecycle events, so local installation state will only be corrected by the periodic sync.
'default_events' => [
'push',
],
app/Actions/GithubApp/RemoveGithubApp.php:29
- Removing the app deletes the GitHub App source-control rows without clearing their
github_app_token_*/repository caches. If the instance is reconfigured and an installation with the same ID is imported before those cache entries expire, the new provider can reuse a stale installation token or repo list from the removed app.
DB::transaction(function (): void {
SourceControl::query()
->where('provider', SourceControl::PROVIDER_GITHUB_APP)
->get()
->each(fn (SourceControl $sc) => $sc->forceDelete());
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
DISCLAIMER
This is NOT the complete functionality. In order to keep PRs smaller, this PR ONLY handles the registration of a GitHub app within Vito, and manages installs as Source Control records - while the listing of repos and branches DOES work, this PR does NOT include deployments (which are planned to use short-lived tokens, instead of deployment keys), as this will be another major refactor, which will come as part of a separate PR.
Overview
This pull request introduces comprehensive support for managing GitHub App-based source control integrations. It adds new actions for creating, editing, importing, syncing, and removing GitHub App installations, as well as a webhook controller for handling GitHub App events. The update also includes improvements to validation, command-line tools, and scheduled syncing to ensure local state remains consistent with GitHub.
GitHub App integration and management:
CreateGithubAppFromManifestandCreateGithubAppManuallyactions for registering a GitHub App via manifest or manual input, with validation and error handling.ImportGithubAppInstallationaction to import a GitHub App installation as aSourceControlentry, including logic to update or restore existing records.RemoveGithubAppaction to safely remove a GitHub App and its associated source controls, ensuring no sites are attached.EditGithubAppSourceControlaction for editing the project association of a GitHub App source control.Synchronization and automation:
SyncGithubAppInstallationsaction and command (SyncGithubAppInstallationsCommand) to reconcile local installations with those on GitHub, tracking added, removed, and kept installations. Scheduled this sync to run every 4 hours via the console kernel.Webhook handling:
GithubAppWebhookControllerto handle GitHub App webhook events, including installation creation, deletion, suspension, and repository changes, with signature verification and error logging.Source control API and validation improvements:
SourceControlControllerto delegate editing to the appropriate action based on whether the source control is a GitHub App.UI