You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Refactor JIRA generation to use Google GenAI SDK
Migrated `GeminiJiraGenerator` to use the official `google.generativeai` SDK
instead of a custom client wrapper. This involved configuring the API key
directly and using `genai.GenerativeModel`.
The response parsing logic was updated to correctly handle potential JSON
blocks (` ```json ... ``` `) returned by the model. The logic for generating
release notes also switched to use the new SDK response handling.
Additionally, added mocking capabilities to `run_jira_create` in `main.py` to
allow testing JIRA payload generation with static data, and extended `PRData`
with convenient properties for `number`, `author`, and `url`.
Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
Generate a release note that clearly communicates the value of this change to end users. Respond with only the release note text, no additional formatting or explanation."""
286
292
287
293
try:
288
-
response=self.client.generate_content(prompt)
294
+
response=self.model.generate_content(prompt)
289
295
ifnotresponse:
290
296
returnNone
291
297
292
298
# Clean and validate the response
293
-
release_note=response.strip()
299
+
release_note=response.text.strip()
294
300
295
301
# Ensure it's not too long (3 lines max, ~200 chars per line)
print("🧪 Running JIRA creation test with mock data...\n")
352
+
353
+
# Mock PR data
354
+
from .pr_dataimportPRData
355
+
356
+
# Mock pr_info data
357
+
mock_pr_info= {
358
+
"number": 123,
359
+
"title": "feat: Add webhook controller for GitHub integration",
360
+
"body": "This PR adds a new webhook controller that handles GitHub webhook events for better integration with Pipelines as Code.\n\nThe controller includes:\n- Event processing for push and pull request events\n- Validation of webhook payloads\n- Integration with existing pipeline triggers",
title="feat: Add webhook controller for GitHub integration",
368
+
description="This PR adds a new webhook controller that handles GitHub webhook events for better integration with Pipelines as Code.\n\nThe controller includes:\n- Event processing for push and pull request events\n- Validation of webhook payloads\n- Integration with existing pipeline triggers",
369
+
files_changed=[
370
+
"pkg/controller/webhook.go",
371
+
"pkg/controller/webhook_test.go",
372
+
"test/e2e/webhook_test.go",
373
+
"docs/webhooks.md",
374
+
],
375
+
commit_messages=[
376
+
"feat: implement webhook controller base structure",
"title": "Implement webhook controller for GitHub integration",
395
+
"description": """h1. Story (Required)
396
+
397
+
As a Pipelines as Code user trying to integrate with GitHub I want webhook controllers that can process GitHub events
398
+
399
+
_This story implements a webhook controller system that enables seamless integration between GitHub and Pipelines as Code, improving the user experience by automating pipeline triggers based on repository events._
400
+
401
+
h2. *Background (Required)*
402
+
403
+
_Currently, the system lacks a dedicated webhook controller for processing GitHub events, which limits the automation capabilities and requires manual intervention for pipeline triggers._
404
+
405
+
h2. *Out of scope*
406
+
407
+
_This story does not include GitLab or Bitbucket webhook integrations, which will be addressed in separate stories._
408
+
409
+
h2. *Approach (Required)*
410
+
411
+
_Implement a webhook controller in the pkg/controller package that includes event processing, payload validation, and integration with existing pipeline trigger mechanisms. The controller will handle push and pull request events from GitHub._
412
+
413
+
h2. *Dependencies*
414
+
415
+
_This story depends on the existing controller framework and pipeline trigger system._
This PR adds a new webhook controller that handles GitHub webhook events for better integration with Pipelines as Code.""",
460
+
}
461
+
462
+
# Mock release note
463
+
mock_release_note="Introduces a new webhook controller for GitHub integration that automatically processes repository events.\nEnables seamless pipeline triggering based on push and pull request events.\nImproves automation capabilities and reduces manual intervention requirements."
0 commit comments