ocean icon indicating copy to clipboard operation
ocean copied to clipboard

[Integration][Github] Added Github Ocean Integration

Open emekanwaoma opened this issue 6 months ago • 2 comments
trafficstars

Description

What - A new GitHub integration for Port's Ocean framework that syncs GitHub resources to Port.

Why - To allow Port users to import and track their GitHub resources in their developer portal.

How - Using GitHub's REST API v3 with async processing, rate limiting, and webhook support.

Type of change

Please leave one option from the following and delete the rest:

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] New Integration (non-breaking change which adds a new integration)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Non-breaking change (fix of existing functionality that will not change current behavior)
  • [ ] Documentation (added/updated documentation)

All tests should be run against the port production environment(using a testing org).

Core testing checklist

  • [ ] Integration able to create all default resources from scratch
  • [ ] Resync finishes successfully
  • [ ] Resync able to create entities
  • [ ] Resync able to update entities
  • [ ] Resync able to detect and delete entities
  • [ ] Scheduled resync able to abort existing resync and start a new one
  • [ ] 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

  • [ ] Integration able to create all default resources from scratch
  • [ ] Resync able to create entities
  • [ ] Resync able to update entities
  • [ ] Resync able to detect and delete entities
  • [ ] Resync finishes successfully
  • [ ] If new resource kind is added or updated in the integration, add example raw data, mapping and expected result to the examples folder in the integration directory.
  • [ ] If resource kind is updated, run the integration with the example data and check if the expected result is achieved
  • [ ] 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

  • [ ] Handled rate limiting
  • [ ] Handled pagination
  • [ ] Implemented the code in async
  • [ ] Support Multi account

Screenshots

Include screenshots from your environment showing how the resources of the integration will look.

API Documentation

Provide links to the API documentation used for this integration.

emekanwaoma avatar May 12 '25 09:05 emekanwaoma

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1619.d1ftd8v2gowp8w.amplifyapp.com

CI Feedback 🧐

(Feedback updated until commit https://github.com/port-labs/ocean/commit/679a706bd8d600daa32012e5f91e275d3088c65d)

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: 🚢 github-v2

Failed stage: Lint [❌]

Failure summary:

The action failed because the linting checks found several errors:

1. Mypy errors in github/core/exporters/workflows_exporter.py:
- Line 28: Name "repo" is not
defined
- Line 34: Name "repo" is not defined

2. Ruff (Python linter) found unused imports:
- unittest.mock.MagicMock imported but unused
-
httpx imported but unused in tests/exporters/test_workflow_exporter.py

The linting step failed with exit code 1, causing the entire workflow to fail with exit code 2.

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

1074:  No dependencies to install or update
1075:  ##[group]Run make lint
1076:  [36;1mmake lint[0m
1077:  shell: /usr/bin/bash -e {0}
1078:  env:
1079:  pythonLocation: /opt/hostedtoolcache/Python/3.12.10/x64
1080:  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.10/x64/lib/pkgconfig
1081:  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.10/x64
1082:  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.10/x64
1083:  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.10/x64
1084:  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.10/x64/lib
1085:  ##[endgroup]
1086:  Running poetry check
1087:  All set!
1088:  Running mypy
1089:  github/core/exporters/workflows_exporter.py:28: error: Name "repo" is not defined  [name-defined]
1090:  github/core/exporters/workflows_exporter.py:34: error: Name "repo" is not defined  [name-defined]
1091:  Found 2 errors in 1 file (checked 33 source files)
1092:  Running ruff
...

1125:  |                                  ^^^^^^^^^ F401
1126:  4 | import httpx
1127:  5 | from github.core.exporters.workflows_exporter import WorkflowExporter
1128:  |
1129:  = help: Remove unused import: `unittest.mock.MagicMock`
1130:  tests/exporters/test_workflow_exporter.py:4:8: F401 [*] `httpx` imported but unused
1131:  |
1132:  2 | import pytest
1133:  3 | from unittest.mock import patch, MagicMock
1134:  4 | import httpx
1135:  |        ^^^^^ F401
1136:  5 | from github.core.exporters.workflows_exporter import WorkflowExporter
1137:  6 | from github.clients.base_client import AbstractGithubClient
1138:  |
1139:  = help: Remove unused import: `httpx`
1140:  Found 5 errors.
1141:  [*] 3 fixable with the `--fix` option.
1142:  Running black
1143:  All done! ✨ 🍰 ✨
1144:  33 files would be left unchanged.
1145:  Running yamllint
1146:  [0;31mOne or more checks failed with exit code 1[0m
1147:  make: *** [../_infra/Makefile:62: lint] Error 1
1148:  ##[error]Process completed with exit code 2.
1149:  Post job cleanup.

qodo-merge-pro[bot] avatar May 16 '25 12:05 qodo-merge-pro[bot]