| | import gradio as gr |
| | import os |
| | from github import Github |
| | from datetime import datetime |
| | import google.generativeai as genai |
| |
|
| | def generate_release_notes(github_url, github_token, gemini_api_key, start_date, end_date): |
| | |
| | genai.configure(api_key=gemini_api_key) |
| | model = genai.GenerativeModel('gemini-2.5-pro-preview-03-25') |
| |
|
| | |
| | g = Github(github_token) |
| |
|
| | |
| | repo_name = github_url.split('/')[-1].replace('.git', '') |
| | repo = g.get_repo(f"MicroHealthLLC/{repo_name}") |
| |
|
| | |
| | start_date = datetime.strptime(start_date, "%Y-%m-%d") |
| | end_date = datetime.strptime(end_date, "%Y-%m-%d") |
| |
|
| | |
| | commits = repo.get_commits(since=start_date, until=end_date) |
| |
|
| | |
| | commit_messages = [commit.commit.message for commit in commits] |
| | commit_text = "\n".join(commit_messages) |
| |
|
| | |
| | prompt = f"Based on the following commit messages, generate comprehensive release notes:\n\n{commit_text}\n\nPlease categorize changes, summarize features, and identify key updates." |
| | response = model.generate_content(prompt) |
| |
|
| | return response.text |
| |
|
| | |
| | iface = gr.Interface( |
| | fn=generate_release_notes, |
| | inputs=[ |
| | gr.Textbox(label="GitHub Repository URL (e.g., https://github.com/MicroHealthLLC/maiko-assistant.git)"), |
| | gr.Textbox(label="GitHub Personal Access Token", type="password"), |
| | gr.Textbox(label="Gemini API Key", type="password"), |
| | gr.Textbox(label="Start Date (YYYY-MM-DD)"), |
| | gr.Textbox(label="End Date (YYYY-MM-DD)") |
| | ], |
| | outputs=gr.Textbox(label="Generated Release Notes"), |
| | title="Automated Release Notes Generator", |
| | description="Generate release notes based on GitHub commits using Gemini AI." |
| | ) |
| |
|
| | |
| | iface.launch() |