Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds automated changelog generation functionality to the version update script. The script now generates changelog entries from git commits using conventional commit format and automatically inserts them into the CHANGELOG.md file during version updates.
Key changes:
- New
generate_changelog.pyscript that parses git commits between branches and formats them as changelog entries - Integration of changelog generation into the
update_version.pyworkflow - New
ChangeLogContenttoken class to handle generated changelog text insertion
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| scripts/generate_changelog.py | New script that fetches git commits, parses conventional commit messages, and generates formatted changelog entries with PR links |
| scripts/update_version.py | Integrates changelog generation by importing the new module, adding ChangeLogContent token class, and passing generated content to update_changelog function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| def fetch_branches(): | ||
| """Fetch the latest changes from origin for master and dev branches.""" | ||
| subprocess.run(["git", "fetch", "origin", "master", "dev"], capture_output=True, check=True) |
There was a problem hiding this comment.
Similar to run_git(), this subprocess call with check=True will raise a generic CalledProcessError on failure. Consider adding error handling or a descriptive message for when the fetch operation fails.
| subprocess.run(["git", "fetch", "origin", "master", "dev"], capture_output=True, check=True) | |
| try: | |
| subprocess.run(["git", "fetch", "origin", "master", "dev"], capture_output=True, check=True) | |
| except subprocess.CalledProcessError as e: | |
| print("Error: Failed to fetch branches 'master' and 'dev' from 'origin'.") | |
| print("Git output:") | |
| print(e.stderr.decode() if hasattr(e.stderr, "decode") else e.stderr) | |
| print("Please check your network connection, remote repository URL, and authentication.") | |
| raise |
| return "No changes to report." | ||
|
|
||
| changes_by_category = parse_changes(release_commits_list) | ||
| return mk_changelog_str(changes_by_category) |
There was a problem hiding this comment.
If parse_changes() returns an empty dictionary (e.g., when commits don't follow conventional commit format), mk_changelog_str() will return an empty string instead of a meaningful message. This could result in inserting blank content into the changelog.
|
I wonder if we can just use a llm and ask him to collect all the commits from last release, and format it. We should try it |
b96b4f5 to
86503ca
Compare
Unfortunately this is not 100% iso with the process release.
To generate the list of change I rely in the commits. Our standard so far is to use pull requets titles. Most of the the time it's identical but not always. I'm not sure how important it is to use the pull request title, maybe the commit message is enough ?
You can still use this script, you'll just need to update the sscript by hard coding the list of change instead of retrieving them dynamically.
To do so rewrite
get_commits_for_release()so it returns the lines you got after drafting a new release.