Add AI-powered automatic release notes generator with PR tracking, manual trigger support, and improved organization#30
Conversation
Co-authored-by: duartebarbosadev <13065435+duartebarbosadev@users.noreply.github.com>
Co-authored-by: duartebarbosadev <13065435+duartebarbosadev@users.noreply.github.com>
|
@copilot Can the scripts be inside the .github folder for better organization and separation and can the release notes include the PR's where the content was added? |
Co-authored-by: duartebarbosadev <13065435+duartebarbosadev@users.noreply.github.com>
I've addressed both of your requests in commit f63d766:
The implementation parses git commit messages to identify PR references and enhances the OpenAI prompts to include this context, resulting in more informative release notes that clearly link changes back to their originating pull requests. |
|
@copilot make it also available to be triggered manually and it will select the last release to do it |
…lease Co-authored-by: duartebarbosadev <13065435+duartebarbosadev@users.noreply.github.com>
I've added manual trigger support to the workflow in commit 42d112d. The workflow now supports:
When triggered manually, the workflow will:
This allows you to regenerate release notes for the most recent release at any time through the GitHub Actions UI. |
what happens if there's already a release note and description on that release? |
Currently, the workflow completely overwrites any existing release notes and description. This means if you manually wrote custom release notes or have existing content, it would be lost and replaced entirely with the AI-generated content. Let me implement a better solution that preserves existing content by default and provides options for how to handle existing notes. |
|
@copilot run ruff check and format and fix any errors |
Co-authored-by: duartebarbosadev <13065435+duartebarbosadev@users.noreply.github.com>
I've run ruff check and format on the codebase and fixed all issues in commit 3f97876. The changes include:
The fixes were minimal and focused on code quality improvements without any functional changes. |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a comprehensive AI-powered automatic release notes generator that leverages OpenAI's API to create user-friendly release notes from git commit data. The system includes PR tracking capabilities, manual workflow triggers, and fallback mechanisms for reliability.
Key Changes
- Implements AI-powered release notes generation using OpenAI GPT-4o-mini with intelligent categorization and user-friendly language
- Adds comprehensive PR information extraction from commit messages with support for various PR reference formats
- Includes complete test coverage, GitHub Actions workflow automation, and graceful fallback mechanisms
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/release-notes-generator.yml |
GitHub Actions workflow for automated release notes generation with manual trigger support |
.github/scripts/generate_release_notes.py |
Core Python script implementing OpenAI integration, git operations, and PR information extraction |
tests/test_release_notes_generator.py |
Comprehensive test suite covering all functionality with mocked dependencies |
requirements-dev.txt |
Added OpenAI dependency for CI environments |
RELEASE_NOTES_GENERATOR.md |
Implementation documentation and setup instructions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| mock_output = """abc123456789|Add new feature (#123)|Implement new UI components===COMMIT_SEPARATOR===def456789012|Fix bug in processing|Fix issue with image processing===COMMIT_SEPARATOR===ghi789012345|Merge pull request #456 from fix/memory-leak|Fix memory leak in image loader | ||
|
|
||
| Fixed memory leak that occurred during batch processing===COMMIT_SEPARATOR===""" | ||
|
|
There was a problem hiding this comment.
The multiline string with hardcoded git output makes the test brittle and difficult to understand. Consider extracting this to a separate variable or using a cleaner format with proper line breaks and indentation for better readability.
| mock_output = """abc123456789|Add new feature (#123)|Implement new UI components===COMMIT_SEPARATOR===def456789012|Fix bug in processing|Fix issue with image processing===COMMIT_SEPARATOR===ghi789012345|Merge pull request #456 from fix/memory-leak|Fix memory leak in image loader | |
| Fixed memory leak that occurred during batch processing===COMMIT_SEPARATOR===""" | |
| mock_output = ( | |
| "abc123456789|Add new feature (#123)|Implement new UI components===COMMIT_SEPARATOR===\n" | |
| "def456789012|Fix bug in processing|Fix issue with image processing===COMMIT_SEPARATOR===\n" | |
| "ghi789012345|Merge pull request #456 from fix/memory-leak|Fix memory leak in image loader\n" | |
| "Fixed memory leak that occurred during batch processing===COMMIT_SEPARATOR===\n" | |
| ) |
| {chr(10).join(changes)}""" | ||
|
|
||
| if pr_section: | ||
| result += f""" | ||
|
|
||
| ### Related Pull Requests: | ||
|
|
||
| {chr(10).join(pr_section)}""" |
There was a problem hiding this comment.
Using chr(10) to represent newlines is unnecessarily obscure. Use '\\n' or the more readable '\\n'.join(changes) for better code clarity.
| {chr(10).join(changes)}""" | |
| if pr_section: | |
| result += f""" | |
| ### Related Pull Requests: | |
| {chr(10).join(pr_section)}""" | |
| {'\n'.join(changes)}""" | |
| if pr_section: | |
| result += f""" | |
| ### Related Pull Requests: | |
| {'\n'.join(pr_section)}""" |
| {chr(10).join(changes)}""" | ||
|
|
||
| if pr_section: | ||
| result += f""" | ||
|
|
||
| ### Related Pull Requests: | ||
|
|
||
| {chr(10).join(pr_section)}""" |
There was a problem hiding this comment.
Using chr(10) to represent newlines is unnecessarily obscure. Use '\\n' or the more readable '\\n'.join(pr_section) for better code clarity.
| {chr(10).join(changes)}""" | |
| if pr_section: | |
| result += f""" | |
| ### Related Pull Requests: | |
| {chr(10).join(pr_section)}""" | |
| {'\n'.join(changes)}""" | |
| if pr_section: | |
| result += f""" | |
| ### Related Pull Requests: | |
| {'\n'.join(pr_section)}""" |
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.