Repository navigation
feat: Add support for personal access tokens in GitHub integration - #31
Merged
Merged
Conversation
- Introduced `tokenRecord` struct to manage personal access token identities. - Updated `spiStore` interface to include methods for loading, creating, updating, and deleting tokens. - Enhanced `ghProvider` to handle token identities, including setup, webhook management, and repository access. - Implemented webhook verification for token identities, ensuring proper handling of events. - Updated tests to cover new token functionality, including setup, credential minting, and webhook management. - Modified plugin description to reflect support for both GitHub App and personal access token connections.
…ing concurrent handling
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.
Summary
Turns the plugin into the GitHub provider for Paca's Git provider SPI (
gitprovider.v1) and gives it two ways to connect: a GitHub App (manifest flow) or a personal access token. Paca core now owns repositories, pull requests, task links, triggers, runs and the UI; this plugin only answers GitHub-specific questions.Needs Paca core with the Git integration (
minCoreVersionv0.20.0), and builds againstplugin-sdk-gov0.4.1.What changed
Provider (
backend/spi_*.go)capabilities.kinds: the App is ephemeral with an app-level webhook and needs an installation per account; the token is static with a webhook per repository and needs no installation.GitHub App connection
contentsread or write; the webhook secret and private key are stored encrypted.Personal access token connection (
spi_token.go)GET /user, its expiry is kept when GitHub reports one, and a mistyped token does not spend the setup state.EnsureWebhookis idempotent for the same URL;RemoveWebhooktolerates one that is already gone); the token needs the webhook permission.[bot]suffix).Data
0002_git_provider.sqlcreatesgithub_apps,github_app_installations,github_tokensandgithub_manifest_sessions(with the setupkind).ENCRYPTION_KEYmust be in place) with its linked repositories, branch links and pull request links. The owner's login and a webhook secret are not known to the migration; both are filled in the first time the token is used. Webhooks the old release registered point at the old plugin and are left on GitHub (use "Try again" on each repository to register a new one).Removed
git_*tables, the Git settings UI, the Git MCP tools).Upgrading
See the README ("Upgrading from 0.4.x"). Existing project tokens keep working as project connections; add Apps from a project's Settings → Git → Connections.
Test plan
go vetandgo testinbackend/(SDK conformance suite, fake GitHub, token flow, webhook parsing, store tests)0002applied on Postgres 16 with old data (tokens, repositories, pull request and branch links) and on a fresh schema.wasmwith tinygo and install it in a Paca instance🤖 Generated with Claude Code