Skip to content

Add AI-powered automatic release notes generator with PR tracking, manual trigger support, and improved organization#30

Merged
duartebarbosadev merged 6 commits intomainfrom
copilot/fix-d035589b-7c79-4e35-beb7-ca9261e669be
Sep 3, 2025
Merged

Add AI-powered automatic release notes generator with PR tracking, manual trigger support, and improved organization#30
duartebarbosadev merged 6 commits intomainfrom
copilot/fix-d035589b-7c79-4e35-beb7-ca9261e669be

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 3, 2025

  • Add AI-powered automatic release notes generator with PR tracking, manual trigger support, and improved organization
  • Move scripts to .github folder for better organization and separation
  • Enhance release notes to include PR information where available
  • Add manual workflow trigger to regenerate release notes for latest release
  • Run ruff check and format to fix linting errors and apply consistent formatting
    • Fixed F541 error: removed unnecessary f-string prefix
    • Applied consistent code formatting across Python files
    • All ruff checks now pass

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits September 3, 2025 17:56
Co-authored-by: duartebarbosadev <13065435+duartebarbosadev@users.noreply.github.com>
Co-authored-by: duartebarbosadev <13065435+duartebarbosadev@users.noreply.github.com>
Copilot AI changed the title [WIP] Create a new CI that will be triggered once theres a new rrelease that will swnd the differences to a openai ai model for it to write the release notes Add AI-powered automatic release notes generator using OpenAI API Sep 3, 2025
@duartebarbosadev
Copy link
Copy Markdown
Owner

@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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 3, 2025

@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?

I've addressed both of your requests in commit f63d766:

  1. Moved scripts to .github folder: The generate_release_notes.py script is now located at .github/scripts/generate_release_notes.py for better organization and separation. The GitHub Actions workflow has been updated to use the new location.

  2. Enhanced PR information support: The release notes now include PR information where available. The script:

    • Extracts PR numbers and titles from commit messages (supports formats like "Fix bug (#123)" and "Merge pull request #456")
    • Includes PR references in the AI-generated release notes (e.g., "Enhanced UI (#123)")
    • Falls back gracefully when PR information isn't available
    • Adds a "Related Pull Requests" section in fallback mode

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 AI changed the title Add AI-powered automatic release notes generator using OpenAI API Add AI-powered automatic release notes generator with PR tracking and improved organization Sep 3, 2025
@duartebarbosadev
Copy link
Copy Markdown
Owner

@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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 3, 2025

@copilot make it also available to be triggered manually and it will select the last release to do it

I've added manual trigger support to the workflow in commit 42d112d. The workflow now supports:

  1. Automatic triggering: Continues to run when releases are published
  2. Manual triggering: Added workflow_dispatch trigger that automatically finds and uses the latest release tag

When triggered manually, the workflow will:

  • Use git describe --tags --abbrev=0 to find the latest release tag
  • Generate release notes for that release using the same AI-powered process
  • Update the existing release with the new notes
  • Handle errors gracefully if no releases exist

This allows you to regenerate release notes for the most recent release at any time through the GitHub Actions UI.

Copilot AI changed the title Add AI-powered automatic release notes generator with PR tracking and improved organization Add AI-powered automatic release notes generator with PR tracking, manual trigger support, and improved organization Sep 3, 2025
@duartebarbosadev
Copy link
Copy Markdown
Owner

@copilot make it also available to be triggered manually and it will select the last release to do it

I've added manual trigger support to the workflow in commit 42d112d. The workflow now supports:

1. **Automatic triggering**: Continues to run when releases are published

2. **Manual triggering**: Added `workflow_dispatch` trigger that automatically finds and uses the latest release tag

When triggered manually, the workflow will:

* Use `git describe --tags --abbrev=0` to find the latest release tag

* Generate release notes for that release using the same AI-powered process

* Update the existing release with the new notes

* Handle errors gracefully if no releases exist

This allows you to regenerate release notes for the most recent release at any time through the GitHub Actions UI.
Help improve Copilot by leaving feedback using the 👍 or 👎 buttons

what happens if there's already a release note and description on that release?

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 3, 2025

@copilot make it also available to be triggered manually and it will select the last release to do it

I've added manual trigger support to the workflow in commit [42d112d](https://github.co...

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.

@duartebarbosadev
Copy link
Copy Markdown
Owner

@copilot run ruff check and format and fix any errors

Co-authored-by: duartebarbosadev <13065435+duartebarbosadev@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Sep 3, 2025

@copilot run ruff check and format and fix any errors

I've run ruff check and format on the codebase and fixed all issues in commit 3f97876. The changes include:

  • Fixed 1 linting error (F541): Removed unnecessary f-string prefix from generate_release_notes.py
  • Applied consistent code formatting across 2 Python files
  • All ruff checks now pass successfully

The fixes were minimal and focused on code quality improvements without any functional changes.

@duartebarbosadev duartebarbosadev marked this pull request as ready for review September 3, 2025 19:22
Copilot AI review requested due to automatic review settings September 3, 2025 19:22
@duartebarbosadev duartebarbosadev merged commit 600f281 into main Sep 3, 2025
3 checks passed
@duartebarbosadev duartebarbosadev deleted the copilot/fix-d035589b-7c79-4e35-beb7-ca9261e669be branch September 3, 2025 19:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +118 to +121
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==="""

Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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"
)

Copilot uses AI. Check for mistakes.
Comment on lines +337 to +344
{chr(10).join(changes)}"""

if pr_section:
result += f"""

### Related Pull Requests:

{chr(10).join(pr_section)}"""
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using chr(10) to represent newlines is unnecessarily obscure. Use '\\n' or the more readable '\\n'.join(changes) for better code clarity.

Suggested change
{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)}"""

Copilot uses AI. Check for mistakes.
Comment on lines +337 to +344
{chr(10).join(changes)}"""

if pr_section:
result += f"""

### Related Pull Requests:

{chr(10).join(pr_section)}"""
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using chr(10) to represent newlines is unnecessarily obscure. Use '\\n' or the more readable '\\n'.join(pr_section) for better code clarity.

Suggested change
{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)}"""

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants