trafficstars
User description
Description
What - Support for workflows and workflow runs for the new Github Ocean integration
Why - To allow users pull in Github workflows
How - Using Github's Rest API
Type of change
Please leave one option from the following and delete the rest:
- [ x ] New feature (non-breaking change which adds functionality)
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
- [ x ] Resync finishes successfully
- [ x ] 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.
https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28
https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28
PR Type
Enhancement, Tests, Documentation
Description
-
Add support for Github workflows and workflow runs:
- Implement exporters for workflows and workflow runs.
- Add webhook processor for workflow run events.
- Extend integration config and resync logic for new kinds.
-
Update Port blueprints and app config for new resource types.
-
Add comprehensive tests for workflow and workflow run exporters and webhook processor.
-
Update documentation and changelog for new features.
Changes walkthrough 📝
| Relevant files |
|---|
| Enhancement | 8 files
workflow_runs_exporter.pyAdd exporter for Github workflow runs |
+36/-0 |
workflows_exporter.pyAdd exporter for Github workflows |
+42/-0 |
options.pyAdd options for workflow and workflow run exporters |
+8/-0 |
utils.pyAdd workflow and workflow run object kinds |
+2/-0 |
events.pyAdd workflow run events to webhook event lists |
+10/-2 |
workflow_run_webhook_processor.pyAdd webhook processor for workflow run events |
+59/-0 |
integration.pyExtend integration config for workflows and workflow runs |
+23/-1 |
main.pyAdd resync logic for workflows and workflow runs |
+48/-1 |
|
| Documentation | 4 files
blueprints.jsonAdd blueprints for workflow and workflow run resources |
+204/-34 |
port-app-config.ymlAdd config mappings for workflow and workflow run resources |
+44/-3 |
spec.yamlAdd workflow and workflow-run kinds to exporter features |
+2/-0 |
CHANGELOG.mdDocument support for workflows and workflow runs |
+8/-1 |
|
| Tests | 4 files
test_workflow_exporter.pyAdd tests for workflow exporter |
+88/-0 |
test_workflow_run_exporter.pyAdd tests for workflow run exporter |
+94/-0 |
test_workflow_run_webhook_processor.pyAdd tests for workflow run webhook processor |
+194/-0 |
test_repository_webhook_processor.pyMinor formatting update in repository webhook processor tests |
+0/-1 |
|
Need help?
Type /help how to ... in the comments thread for any questions about Qodo Merge usage.Check out the documentation for more information.
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.
CI Feedback 🧐
A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
Action: validate-files |
|
Failed stage: Check Ocean version 🌊 [❌]
|
|
Failure summary:
The action failed because the script couldn't find the directory 'integrations/jira-server' (line 795). The script was checking changed directories to verify if the Ocean version in each integration's pyproject.toml file was updated to the latest version. The error occurred when it tried to process 'integrations/jira-server' but this directory doesn't exist in the repository.
|
Relevant error logs:
1: ##[group]Runner Image Provisioner
2: Hosted Compute Agent
...
115: [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
116: [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
117: [command]/usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
118: ##[endgroup]
119: ##[group]Fetching the repository
120: [command]/usr/bin/git -c protocol.version=2 fetch --prune --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* +743c61f39eee7914ce701d92be5e789c18fad824:refs/remotes/pull/1637/merge
121: From https://github.com/port-labs/ocean
122: * [new branch] Github-tj-actions-bug-fix -> origin/Github-tj-actions-bug-fix
123: * [new branch] PORT-10639-add-memray-to-jira-integration -> origin/PORT-10639-add-memray-to-jira-integration
124: * [new branch] PORT-10680-Add-default-actions-for-Jira-integration -> origin/PORT-10680-Add-default-actions-for-Jira-integration
125: * [new branch] PORT-10680-Add-default-actions-for-PagerDuty-integration -> origin/PORT-10680-Add-default-actions-for-PagerDuty-integration
126: * [new branch] PORT-10776-Default-Action-for-Snyk-Ocean-Integration -> origin/PORT-10776-Default-Action-for-Snyk-Ocean-Integration
127: * [new branch] PORT-10933-bug-snyk-ingesting-vulnerabilities-from-wrong-org -> origin/PORT-10933-bug-snyk-ingesting-vulnerabilities-from-wrong-org
128: * [new branch] PORT-11183-fix-starlette-denial-of-service-do-s-via-multipart-form-data -> origin/PORT-11183-fix-starlette-denial-of-service-do-s-via-multipart-form-data
129: * [new branch] PORT-11220-automate-git-tag-when-pushing-a-new-commit-to-main -> origin/PORT-11220-automate-git-tag-when-pushing-a-new-commit-to-main
130: * [new branch] PORT-11682-ocean-handle-and-log-errors-of-client-timeouts-when-interacting-with-port-api-upserting-etc -> origin/PORT-11682-ocean-handle-and-log-errors-of-client-timeouts-when-interacting-with-port-api-upserting-etc
131: * [new branch] PORT-12105-Bug-Pagination-logic-error-in-the-SonarQube-integration -> origin/PORT-12105-Bug-Pagination-logic-error-in-the-SonarQube-integration
132: * [new branch] PORT-12472/gitlab-merge-request-event -> origin/PORT-12472/gitlab-merge-request-event
...
148: * [new branch] PORT-14350 -> origin/PORT-14350
149: * [new branch] PORT-14408-Add-Support-For-OAuth2-Authentication -> origin/PORT-14408-Add-Support-For-OAuth2-Authentication
150: * [new branch] PORT-14421 -> origin/PORT-14421
151: * [new branch] PORT-14503-integrations-monitoring-generate-data-structure-to-send -> origin/PORT-14503-integrations-monitoring-generate-data-structure-to-send
152: * [new branch] PORT-14506 -> origin/PORT-14506
153: * [new branch] PORT-14509 -> origin/PORT-14509
154: * [new branch] PORT-14554-Prepare-A-Script-To-Remove-Dangling-Entities -> origin/PORT-14554-Prepare-A-Script-To-Remove-Dangling-Entities
155: * [new branch] PORT-14591-Bug-enkins-integration-fails-to-fetch-Build-and-Job-data-due-to-malformed-URL -> origin/PORT-14591-Bug-enkins-integration-fails-to-fetch-Build-and-Job-data-due-to-malformed-URL
156: * [new branch] PORT-14640-shutting-down-gracefully-on-ocean-resync-exception -> origin/PORT-14640-shutting-down-gracefully-on-ocean-resync-exception
157: * [new branch] PORT-4308-ocean-support-pydantic-v-2 -> origin/PORT-4308-ocean-support-pydantic-v-2
158: * [new branch] PORT-8504-add-configurable-limit-for-wiz-import-issues -> origin/PORT-8504-add-configurable-limit-for-wiz-import-issues
159: * [new branch] PORT-8596-add-the-ability-to-ingest-ami-images-and-acm-certificate-from-aws-new-integration-into-port -> origin/PORT-8596-add-the-ability-to-ingest-ami-images-and-acm-certificate-from-aws-new-integration-into-port
160: * [new branch] PORT-8788-Add-deployment-method-requirements-field -> origin/PORT-8788-Add-deployment-method-requirements-field
161: * [new branch] PORT-9072 -> origin/PORT-9072
162: * [new branch] PORT-9097-ocean-icons-are-not-synced -> origin/PORT-9097-ocean-icons-are-not-synced
163: * [new branch] PORT-9326-bug-sonarqube-integration-throws-errors -> origin/PORT-9326-bug-sonarqube-integration-throws-errors
164: * [new branch] PORT-9612-add-sonar-project-properties-file-to-ocean-integration-code-base -> origin/PORT-9612-add-sonar-project-properties-file-to-ocean-integration-code-base
...
219: * [new branch] feat-delete-unused-TF-files -> origin/feat-delete-unused-TF-files
220: * [new branch] feat-remove-polling-logs -> origin/feat-remove-polling-logs
221: * [new branch] feat/bitbucket -> origin/feat/bitbucket
222: * [new branch] feat/port-7767-support-exporting-jira-issues-by-sprint -> origin/feat/port-7767-support-exporting-jira-issues-by-sprint
223: * [new branch] feature-bump-single-integration -> origin/feature-bump-single-integration
224: * [new branch] fetch_and_jq -> origin/fetch_and_jq
225: * [new branch] fix-dev-komodor-integration -> origin/fix-dev-komodor-integration
226: * [new branch] fix-memory-leak-with-fastapi -> origin/fix-memory-leak-with-fastapi
227: * [new branch] fix-unexpected-lack-of-config -> origin/fix-unexpected-lack-of-config
228: * [new branch] fix/strip-app-host -> origin/fix/strip-app-host
229: * [new branch] format_url_types -> origin/format_url_types
230: * [new branch] gitlab-param-change -> origin/gitlab-param-change
231: * [new branch] gitlab-v2 -> origin/gitlab-v2
232: * [new branch] jira-oauth-support -> origin/jira-oauth-support
233: * [new branch] jortegac/main -> origin/jortegac/main
234: * [new branch] jq_next-assertion-error -> origin/jq_next-assertion-error
235: * [new branch] label-prs -> origin/label-prs
236: * [new branch] main -> origin/main
237: * [new branch] mapping_rule_schema_fix -> origin/mapping_rule_schema_fix
238: * [new branch] multiprocessing -> origin/multiprocessing
239: * [new branch] oauth-token-refresh-by-error-mode -> origin/oauth-token-refresh-by-error-mode
240: * [new branch] ocean_11_memo_leak -> origin/ocean_11_memo_leak
...
570: Successfully installed PyYAML-6.0.2 argcomplete-3.6.2 click-8.1.8 markdown-it-py-3.0.0 mdurl-0.1.2 packaging-25.0 pygments-2.19.1 regex-2024.11.6 rich-14.0.0 shellingham-1.5.4 toml-cli-0.7.0 tomlkit-0.13.2 typer-0.15.4 typing-extensions-4.13.2 xmltodict-0.14.2 yq-3.4.3
571: [notice] A new release of pip is available: 25.1 -> 25.1.1
572: [notice] To update, run: pip install --upgrade pip
573: ##[group]Run git remote add ocean-origin https://github.com/port-labs/ocean.git
574: [36;1mgit remote add ocean-origin https://github.com/port-labs/ocean.git[0m
575: [36;1mgit fetch ocean-origin[0m
576: [36;1mchanged_dirs=$(git diff --name-only ocean-origin/main HEAD | grep 'integrations/' | cut -d'/' -f 1,2 | sort -u)[0m
577: [36;1mpackage_version=$(curl -s https://pypi.org/pypi/port-ocean/json | jq -r '.info.version')[0m
578: [36;1mfor dir in $changed_dirs; do[0m
579: [36;1m pyproject_file=$(find $dir -name 'pyproject.toml' -not -path "**/.venv/*")[0m
580: [36;1m if [ -n "$pyproject_file" ]; then[0m
581: [36;1m installed_version=$(toml get tool.poetry.dependencies.port_ocean.version --toml-path $pyproject_file)[0m
582: [36;1m is_version_updated=$(python -c "from packaging import version;print(version.parse('$installed_version'.lstrip('^')) >= version.parse('$package_version'))")[0m
583: [36;1m[0m
584: [36;1m if [ "$is_version_updated" = "False" ]; then[0m
585: [36;1m echo "ERROR: Ocean version in $pyproject_file is not updated to latest version -> $package_version"[0m
586: [36;1m exit 1[0m
...
595: PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.10/x64/lib/pkgconfig
596: Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.10/x64
597: Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.10/x64
598: Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.10/x64
599: LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.10/x64/lib
600: ##[endgroup]
601: From https://github.com/port-labs/ocean
602: * [new branch] Github-tj-actions-bug-fix -> ocean-origin/Github-tj-actions-bug-fix
603: * [new branch] PORT-10639-add-memray-to-jira-integration -> ocean-origin/PORT-10639-add-memray-to-jira-integration
604: * [new branch] PORT-10680-Add-default-actions-for-Jira-integration -> ocean-origin/PORT-10680-Add-default-actions-for-Jira-integration
605: * [new branch] PORT-10680-Add-default-actions-for-PagerDuty-integration -> ocean-origin/PORT-10680-Add-default-actions-for-PagerDuty-integration
606: * [new branch] PORT-10776-Default-Action-for-Snyk-Ocean-Integration -> ocean-origin/PORT-10776-Default-Action-for-Snyk-Ocean-Integration
607: * [new branch] PORT-10933-bug-snyk-ingesting-vulnerabilities-from-wrong-org -> ocean-origin/PORT-10933-bug-snyk-ingesting-vulnerabilities-from-wrong-org
608: * [new branch] PORT-11183-fix-starlette-denial-of-service-do-s-via-multipart-form-data -> ocean-origin/PORT-11183-fix-starlette-denial-of-service-do-s-via-multipart-form-data
609: * [new branch] PORT-11220-automate-git-tag-when-pushing-a-new-commit-to-main -> ocean-origin/PORT-11220-automate-git-tag-when-pushing-a-new-commit-to-main
610: * [new branch] PORT-11682-ocean-handle-and-log-errors-of-client-timeouts-when-interacting-with-port-api-upserting-etc -> ocean-origin/PORT-11682-ocean-handle-and-log-errors-of-client-timeouts-when-interacting-with-port-api-upserting-etc
611: * [new branch] PORT-12105-Bug-Pagination-logic-error-in-the-SonarQube-integration -> ocean-origin/PORT-12105-Bug-Pagination-logic-error-in-the-SonarQube-integration
612: * [new branch] PORT-12472/gitlab-merge-request-event -> ocean-origin/PORT-12472/gitlab-merge-request-event
...
628: * [new branch] PORT-14350 -> ocean-origin/PORT-14350
629: * [new branch] PORT-14408-Add-Support-For-OAuth2-Authentication -> ocean-origin/PORT-14408-Add-Support-For-OAuth2-Authentication
630: * [new branch] PORT-14421 -> ocean-origin/PORT-14421
631: * [new branch] PORT-14503-integrations-monitoring-generate-data-structure-to-send -> ocean-origin/PORT-14503-integrations-monitoring-generate-data-structure-to-send
632: * [new branch] PORT-14506 -> ocean-origin/PORT-14506
633: * [new branch] PORT-14509 -> ocean-origin/PORT-14509
634: * [new branch] PORT-14554-Prepare-A-Script-To-Remove-Dangling-Entities -> ocean-origin/PORT-14554-Prepare-A-Script-To-Remove-Dangling-Entities
635: * [new branch] PORT-14591-Bug-enkins-integration-fails-to-fetch-Build-and-Job-data-due-to-malformed-URL -> ocean-origin/PORT-14591-Bug-enkins-integration-fails-to-fetch-Build-and-Job-data-due-to-malformed-URL
636: * [new branch] PORT-14640-shutting-down-gracefully-on-ocean-resync-exception -> ocean-origin/PORT-14640-shutting-down-gracefully-on-ocean-resync-exception
637: * [new branch] PORT-4308-ocean-support-pydantic-v-2 -> ocean-origin/PORT-4308-ocean-support-pydantic-v-2
638: * [new branch] PORT-8504-add-configurable-limit-for-wiz-import-issues -> ocean-origin/PORT-8504-add-configurable-limit-for-wiz-import-issues
639: * [new branch] PORT-8596-add-the-ability-to-ingest-ami-images-and-acm-certificate-from-aws-new-integration-into-port -> ocean-origin/PORT-8596-add-the-ability-to-ingest-ami-images-and-acm-certificate-from-aws-new-integration-into-port
640: * [new branch] PORT-8788-Add-deployment-method-requirements-field -> ocean-origin/PORT-8788-Add-deployment-method-requirements-field
641: * [new branch] PORT-9072 -> ocean-origin/PORT-9072
642: * [new branch] PORT-9097-ocean-icons-are-not-synced -> ocean-origin/PORT-9097-ocean-icons-are-not-synced
643: * [new branch] PORT-9326-bug-sonarqube-integration-throws-errors -> ocean-origin/PORT-9326-bug-sonarqube-integration-throws-errors
644: * [new branch] PORT-9612-add-sonar-project-properties-file-to-ocean-integration-code-base -> ocean-origin/PORT-9612-add-sonar-project-properties-file-to-ocean-integration-code-base
...
699: * [new branch] feat-delete-unused-TF-files -> ocean-origin/feat-delete-unused-TF-files
700: * [new branch] feat-remove-polling-logs -> ocean-origin/feat-remove-polling-logs
701: * [new branch] feat/bitbucket -> ocean-origin/feat/bitbucket
702: * [new branch] feat/port-7767-support-exporting-jira-issues-by-sprint -> ocean-origin/feat/port-7767-support-exporting-jira-issues-by-sprint
703: * [new branch] feature-bump-single-integration -> ocean-origin/feature-bump-single-integration
704: * [new branch] fetch_and_jq -> ocean-origin/fetch_and_jq
705: * [new branch] fix-dev-komodor-integration -> ocean-origin/fix-dev-komodor-integration
706: * [new branch] fix-memory-leak-with-fastapi -> ocean-origin/fix-memory-leak-with-fastapi
707: * [new branch] fix-unexpected-lack-of-config -> ocean-origin/fix-unexpected-lack-of-config
708: * [new branch] fix/strip-app-host -> ocean-origin/fix/strip-app-host
709: * [new branch] format_url_types -> ocean-origin/format_url_types
710: * [new branch] gitlab-param-change -> ocean-origin/gitlab-param-change
711: * [new branch] gitlab-v2 -> ocean-origin/gitlab-v2
712: * [new branch] jira-oauth-support -> ocean-origin/jira-oauth-support
713: * [new branch] jortegac/main -> ocean-origin/jortegac/main
714: * [new branch] jq_next-assertion-error -> ocean-origin/jq_next-assertion-error
715: * [new branch] label-prs -> ocean-origin/label-prs
716: * [new branch] main -> ocean-origin/main
717: * [new branch] mapping_rule_schema_fix -> ocean-origin/mapping_rule_schema_fix
718: * [new branch] multiprocessing -> ocean-origin/multiprocessing
719: * [new branch] oauth-token-refresh-by-error-mode -> ocean-origin/oauth-token-refresh-by-error-mode
720: * [new branch] ocean_11_memo_leak -> ocean-origin/ocean_11_memo_leak
...
781: * [new branch] snyk-upgrade-c0cc22d8bc9a14f9f9b16f4f2601f29d -> ocean-origin/snyk-upgrade-c0cc22d8bc9a14f9f9b16f4f2601f29d
782: * [new branch] snyk-upgrade-c360637938d20f9dc0bfa4b8e6e9c425 -> ocean-origin/snyk-upgrade-c360637938d20f9dc0bfa4b8e6e9c425
783: * [new branch] snyk-upgrade-c4308db9fedbf20f486a386e785bcec5 -> ocean-origin/snyk-upgrade-c4308db9fedbf20f486a386e785bcec5
784: * [new branch] snyk-upgrade-d18f88847cd5952ae3466151a60ac401 -> ocean-origin/snyk-upgrade-d18f88847cd5952ae3466151a60ac401
785: * [new branch] snyk-upgrade-d3b08700f6c7b35ad696d6e0ccbb7c19 -> ocean-origin/snyk-upgrade-d3b08700f6c7b35ad696d6e0ccbb7c19
786: * [new branch] snyk-upgrade-e030c59e680e225c2560aa5c7c7fb864 -> ocean-origin/snyk-upgrade-e030c59e680e225c2560aa5c7c7fb864
787: * [new branch] snyk-upgrade-ec34358e4330c12b9936c44978129497 -> ocean-origin/snyk-upgrade-ec34358e4330c12b9936c44978129497
788: * [new branch] snyk-upgrade-ef6788d7d595933a67b7b289999f37ee -> ocean-origin/snyk-upgrade-ef6788d7d595933a67b7b289999f37ee
789: * [new branch] snyk-upgrade-ff035b88aaaed39de6c7f6b33c85f98d -> ocean-origin/snyk-upgrade-ff035b88aaaed39de6c7f6b33c85f98d
790: * [new branch] test-fastapi -> ocean-origin/test-fastapi
791: * [new branch] test-pr -> ocean-origin/test-pr
792: * [new branch] update-depdendencies -> ocean-origin/update-depdendencies
793: * [new branch] upserts_no_save -> ocean-origin/upserts_no_save
794: Ocean version is valid in integrations/github-v2/pyproject.toml
795: find: ‘integrations/jira-server’: No such file or directory
796: ##[error]Process completed with exit code 1.
797: Post job cleanup.
|
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
| ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪ |
| 🧪 PR contains tests |
| 🔒 No security concerns identified |
⚡ Recommended focus areas for review
Missing Webhook Processor
The WorkflowRunWebhookProcessor is implemented but not registered in main.py. This will prevent workflow run webhooks from being processed.
ocean.add_webhook_processor("/webhook", RepositoryWebhookProcessor)
Logging Inconsistency
The log message indicates fetching workflows but the actual data is workflow runs, which could be confusing for debugging.
logger.info(
f"fetched batch of {workflow_batch['total_count']} workflows from repository - {options['repo']}"
)
Incomplete Action Handling
The webhook processor only checks if the action is in WORKFLOW_DELETE_EVENTS but doesn't verify it's in WORKFLOW_UPSERT_EVENTS before fetching the resource.
if action in WORKFLOW_DELETE_EVENTS:
logger.info(f"Workflow run {workflow_run['name']} was deleted")
return WebhookEventRawResults(
updated_raw_results=[], deleted_raw_results=[workflow_run]
)
|
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| Possible issue |
✅ Register missing webhook processor
Suggestion Impact:The suggestion was implemented exactly as recommended. The commit added the import for WorkflowRunWebhookProcessor and registered it with the ocean framework by adding ocean.add_webhook_processor('/webhook', WorkflowRunWebhookProcessor).
code diff:
+from github.webhook.webhook_processors.workflow_run_webhook_processor import (
+ WorkflowRunWebhookProcessor,
+)
from integration import (
GithubRepositoryConfig,
GithubWorkflowConfig,
@@ -104,3 +107,4 @@
ocean.add_webhook_processor("/webhook", RepositoryWebhookProcessor)
+ocean.add_webhook_processor("/webhook", WorkflowRunWebhookProcessor)
The PR adds a WorkflowRunWebhookProcessor but doesn't register it with the ocean framework. You need to add the new webhook processor to handle workflow run events.
integrations/github-v2/main.py [106-107]
+from github.webhook.webhook_processors.workflow_run_webhook_processor import WorkflowRunWebhookProcessor
+
ocean.add_webhook_processor("/webhook", RepositoryWebhookProcessor)
+ocean.add_webhook_processor("/webhook", WorkflowRunWebhookProcessor)
[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 8
__
Why: Registering the new WorkflowRunWebhookProcessor is essential for the system to handle workflow run webhook events. Omitting this would prevent the new functionality from working, making this a high-impact and necessary change for correctness.
| Medium
|
Fix deletion event handling
The webhook processor is incorrectly handling workflow run deletion events. When a workflow run is deleted, you should include the repository information in the workflow_run object to ensure proper entity identification during deletion.
integrations/github-v2/github/webhook/webhook_processors/workflow_run_webhook_processor.py [34-39]
if action in WORKFLOW_DELETE_EVENTS:
logger.info(f"Workflow run {workflow_run['name']} was deleted")
-
+
+ # Add repo information to ensure proper entity identification during deletion
+ workflow_run_with_repo = {**workflow_run, "repository": repo}
+
return WebhookEventRawResults(
- updated_raw_results=[], deleted_raw_results=[workflow_run]
+ updated_raw_results=[], deleted_raw_results=[workflow_run_with_repo]
)
Suggestion importance[1-10]: 7
__
Why: The suggestion improves the deletion event handling by ensuring the repository information is included in the deleted result, which can be important for downstream entity identification. This is a moderate but not critical improvement, as it addresses a potential edge case in entity resolution.
| Medium
|
|
| |
CI Feedback 🧐
(Feedback updated until commit https://github.com/port-labs/ocean/commit/02a581f9bc8927fb1c5c8ebeae9d8a304c6b4dfc)
A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
Action: 🚢 github |
|
Failed stage: Lint [❌]
|
|
Failure summary:
The action failed due to a syntax error in github/webhook/registry.py at line 28. There is an unclosed parenthesis in an import statement. The error shows that line 28 has an opening parenthesis that was never closed, and line 29 is missing a closing parenthesis before the newline. This syntax error prevented the linting tools (mypy, ruff, and black) from processing the file successfully.
|
Relevant error logs:
1: ##[group]Runner Image Provisioner
2: Hosted Compute Agent
...
1085: No dependencies to install or update
1086: ##[group]Run make lint
1087: [36;1mmake lint[0m
1088: shell: /usr/bin/bash -e {0}
1089: env:
1090: pythonLocation: /opt/hostedtoolcache/Python/3.12.10/x64
1091: PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.10/x64/lib/pkgconfig
1092: Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.10/x64
1093: Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.10/x64
1094: Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.10/x64
1095: LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.10/x64/lib
1096: ##[endgroup]
1097: Running poetry check
1098: All set!
1099: Running mypy
1100: github/webhook/registry.py:28: error: '(' was never closed [syntax]
1101: Found 1 error in 1 file (errors prevented further checking)
1102: Running ruff
1103: warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `pyproject.toml`:
1104: - 'ignore' -> 'lint.ignore'
1105: github/webhook/registry.py:29:30: SyntaxError: Expected ')', found newline
1106: |
1107: 27 | )
1108: 28 | from github.webhook.webhook_processors.workflow_webhook_processor import (
1109: 29 | WorkflowWebhookProcessor,
1110: | ^
1111: 30 | from github.webhook.webhook_processors.dependabot_webhook_processor import (
1112: 31 | DependabotAlertWebhookProcessor,
1113: 32 | )
1114: |
1115: Found 1 error.
1116: Running black
1117: error: cannot format /home/runner/work/ocean/ocean/integrations/github/github/webhook/registry.py: Cannot parse for target version Python 3.11: 30:0: from github.webhook.webhook_processors.dependabot_webhook_processor import (
1118: Oh no! 💥 💔 💥
1119: 88 files would be left unchanged, 1 file would fail to reformat.
1120: Running yamllint
1121: [0;32mAll checks executed successfully.[0m
1122: make: *** [../_infra/Makefile:62: lint] Error 123
1123: ##[error]Process completed with exit code 2.
1124: Post job cleanup.
|