-
Notifications
You must be signed in to change notification settings - Fork 2
feat(task-manager): GitHub integration #617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Introduces a GitHubService class for interacting with the GitHub API, including methods for app installation, issue creation, and Copilot assignment. Adds related environment variables to .env.sample and type definitions to env.d.ts. Updates dependencies to include @octokit/rest, @octokit/types, and jsonwebtoken v9.0.3. Provides comprehensive tests for the new integration.
Introduces GraphQL types and mutations for managing Task Manager integration in projects, including disconnecting and updating settings. Updates the project model to support partial updates, extends resolvers for new mutations, and adds comprehensive tests for these features.
Introduces GitHub integration endpoints and service, including a Redis-backed state store for secure installation flow. Refactors integration code into modular files, appends GitHub routes to the Express app, and updates tests to import the service from its new location.
Refactored the /integration/github/connect endpoint to return a JSON object with the installation redirect URL instead of performing a direct redirect, and added colorized logging with environment-based suppression for tests. Updated Jest and argon2 dependencies, added Jest moduleNameMapper for node:crypto and node:util, and introduced mocks for these modules. Added comprehensive tests for the GitHub integration connect route.
Implemented /callback endpoint to handle GitHub App installation callbacks and save configuration to the project. Added /webhook endpoint to securely process GitHub webhook events, including removal of taskManager config on installation deletion. Improved logging with project context and added utility functions for URL building and signature verification.
Introduces endpoints to list and update GitHub repositories for a project, adds a Repository type to the GitHub service, and refactors project admin access validation. Also adds the TaskManagerItem GraphQL type and links it to the Event type for improved integration with task managers like GitHub Issues.
Introduces GitHub OAuth flow for user-to-server tokens, including endpoints for handling OAuth callbacks and exchanging codes for tokens. Updates the GitHub service to support OAuth code exchange, token validation, and refresh, and adds required environment variables for client ID and secret. Updates dependencies to support new OAuth methods and expands the project model to store task manager configuration.
Updated the assignCopilot method to use the user-to-server OAuth token and GitHub GraphQL API for assigning the Copilot agent to issues. Improved error handling, added detailed logging, and ensured compatibility with the Copilot bot assignment process. Also added input validation for installationId in relevant methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces GitHub App integration for a Task Manager feature based on GitHub Issues. The implementation includes OAuth flows, webhook handling, GraphQL API extensions, and Redis-backed state management.
Changes:
- Added GitHub App integration infrastructure with secure OAuth flows, webhook handling (including HMAC signature verification), and Redis-backed installation state store
- Extended GraphQL schema with Task Manager types, mutations, and event fields to support GitHub Issue linking
- Updated project model to support partial updates and added taskManager configuration field
- Upgraded test dependencies (Jest 26→30, ts-jest, @types/jest) and updated test files to remove deprecated
donecallbacks
Reviewed changes
Copilot reviewed 26 out of 29 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/integrations/github/service.ts | Core GitHub API service with JWT/OAuth authentication, issue creation, and Copilot assignment |
| src/integrations/github/routes.ts | Express routes for OAuth flows, webhooks, and repository management |
| src/integrations/github/store/install-state.redis.store.ts | Redis-backed store for OAuth state with atomic operations |
| src/resolvers/project.js | New mutations for connecting/disconnecting Task Manager and updating settings |
| src/models/project.ts | Updated updateProject to support partial updates |
| src/typeDefs/*.ts | GraphQL type definitions for Task Manager, settings, and event integration |
| package.json | Dependency updates including Octokit libraries, Jest 30, argon2, and jsonwebtoken |
| test/resolvers/project.test.ts | Comprehensive tests for Task Manager mutations |
| test/integrations/github*.test.ts | Tests for GitHub service and routes |
| .env.sample | Sample configuration for GitHub App credentials |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Refactored GitHub OAuth and installation flow to provide more accurate error redirects and preserve existing taskManager config values. Enhanced timing-safe signature validation using crypto.timingSafeEqual. Updated GraphQL query in GitHubService to use variable for issue number. Expanded and improved test coverage for GitHub routes, including edge cases and config preservation. Refactored project resolver tests for better type safety and error handling.
Adjusts mock project update logic to correctly preserve null values for taskManager when explicitly set, ensuring accurate test behavior for scenarios like disconnectTaskManager. Also refactors test setup in GitHub routes integration test for clarity.
This PR adds the initial GitHub App integration and basic support for a Task Manager based on GitHub Issues.
Key changes include:
This lays the foundation for future Task Manager features and deeper GitHub integration.