Test create cloud GitHub integration implementation
User description
Description
What - An integration to sync GitHub Cloud resources to the Port Platform, including repositories, pull requests, teams, members, and workflow runs.
Why - To allow users to import and track their GitHub Cloud resources on the Port Platform, enabling better visibility and management of their GitHub ecosystem.
How - By implementing a robust integration that:
-
Maps GitHub Cloud resources to Port concepts
-
Handles webhook events for real-time updates
-
Provides resync capabilities for all resource types
-
Supports both organization and repository-level webhooks
-
Implements proper error handling and rate limiting
-
Uses async operations for better performance
-
Includes comprehensive logging and monitoring
Type of change
- [x] New Integration (non-breaking change which adds a new integration)
All tests should be run against the port production environment(using a testing org).
Core testing checklist
- [x] Integration able to create all default resources from scratch
- [x] Resync finishes successfully
- [x] Resync able to create entities
- [x] Resync able to update entities
- [x] Resync able to detect and delete entities
- [ ] Scheduled resync able to abort existing resync and start a new one
- [x] Tested with at least 2 integrations from scratch
- [ ] Tested with Kafka and Polling event listeners
- [ ] Tested deletion of entities that don't pass the selector
Integration testing checklist
- [x] Integration able to create all default resources from scratch
- [x] Resync able to create entities
- [x] Resync able to update entities
- [x] Resync able to detect and delete entities
- [x] Resync finishes successfully
- [x] If new resource kind is added or updated in the integration, add example raw data, mapping and expected result to the
examplesfolder in the integration directory. - [x] If resource kind is updated, run the integration with the example data and check if the expected result is achieved
- [x] If new resource kind is added or updated, validate that live-events for that resource are working as expected
- [ ] Docs PR link here
Preflight checklist
- [x] Handled rate limiting
- [x] Handled pagination
- [x] Implemented the code in async
- [ ] Support Multi account
Screenshots
API Documentation
- GitHub REST API v3: https://docs.github.com/en/rest
- GitHub Webhooks: https://docs.github.com/en/developers/webhooks-and-events/webhooks
- GitHub GraphQL API: https://docs.github.com/en/graphql The integration supports the following resource types: Repositories Pull Requests Teams with Members Members Workflow Runs Workflow Jobs
PR Type
Enhancement, Tests, Documentation, Other, Configuration changes
Description
-
Implements a comprehensive GitHub Cloud integration for the Port Platform, enabling synchronization and management of repositories, pull requests, teams, members, and workflow runs.
-
Adds robust async clients for interacting with the GitHub Cloud REST API, including authentication, rate limiting, pagination, and resource enrichment.
-
Introduces entity processors for handling file and search references, as well as utilities for file content parsing (JSON, YAML).
-
Implements full resync logic with batch processing, enrichment options, and error handling.
-
Provides webhook event configuration, factories, and processors for real-time updates on repositories and pull requests.
-
Registers integration handlers and startup logic in the main entrypoint.
-
Adds extensive test coverage for clients, entity processors, webhook logic, and utilities using pytest fixtures and isolated mocks.
-
Includes detailed documentation: README, contributing guidelines, and changelog.
-
Adds configuration files for environment variables, Docker, Poetry, Port integration specs, blueprints, and resource mapping.
-
Provides a Makefile for development, CI workflows, and project automation.
Changes walkthrough 📝
| Relevant files | |||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement | 20 files
| ||||||||||||||||||||||||||||||||||||||||
| Miscellaneous | 1 files
| ||||||||||||||||||||||||||||||||||||||||
| Tests | 9 files
| ||||||||||||||||||||||||||||||||||||||||
| Documentation | 3 files
| ||||||||||||||||||||||||||||||||||||||||
| Configuration changes | 8 files
| ||||||||||||||||||||||||||||||||||||||||
| Additional files |
Need help?
Type /help how to ...in the comments thread for any questions about Qodo Merge usage.Check out the documentation for more information.
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
| ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪ |
| 🧪 PR contains tests |
| 🔒 Security concerns Sensitive information exposure: |
⚡ Recommended focus areas for reviewError Handling
|
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| Possible issue |
Fix indentation errorFix the indentation error in the code block. The logger statement is incorrectly integrations/github-cloud/github_cloud/clients/github_client.py [177-180]
Suggestion importance[1-10]: 9__ Why: The suggestion correctly identifies and fixes a critical indentation error that would cause a syntax error and prevent the code from running. Proper indentation is essential in Python, making this a high-impact correction. | High |
Improve error handlingThe dictionary comprehension has a potential bug with the walrus operator (:=) integrations/github-cloud/github_cloud/clients/rest_client.py [239-244]
Suggestion importance[1-10]: 7__ Why: The suggestion improves the robustness and clarity of the dictionary comprehension by making the parsing logic explicit and easier to follow, reducing the risk of subtle bugs with the walrus operator. While not a critical bug fix, it enhances maintainability and correctness. | Medium | |
Fix redundant string replacementThe current code is replacing "/hooks" with "/hooks", which is a no-op operation integrations/github-cloud/github_cloud/webhook/webhook_factory/_base_webhook_factory.py [76-77]
Suggestion importance[1-10]: 6__ Why: The suggestion removes a redundant and confusing string replacement operation that has no effect, clarifying the code and preventing potential future confusion or errors. This is a minor but worthwhile improvement. | Low | |
| General |
Improve PR state handlingHandle the "closed" action more specifically by checking if the pull request was
Suggestion importance[1-10]: 8__ Why: This suggestion ensures accurate state representation for merged pull requests, which is important for downstream systems relying on correct PR status, making it a high-impact correctness improvement. | Medium |
Add request timeoutAdd a timeout parameter to the HTTP request to prevent indefinite waiting for integrations/github-cloud/github_cloud/clients/base_client.py [30-64]
Suggestion importance[1-10]: 7__ Why: Introducing a timeout to HTTP requests is a good practice to prevent indefinite hangs, improving reliability, but is not a critical bug fix. | Medium | |
Track failed operationsAdd error count tracking to provide a complete summary of webhook creation
Suggestion importance[1-10]: 6__ Why: Adding error count tracking and reporting in | Low | |
| ||
This pull request is automatically being deployed by Amplify Hosting (learn more).
Access this pull request here: https://pr-1681.d1ftd8v2gowp8w.amplifyapp.com