-
Notifications
You must be signed in to change notification settings - Fork 14
Automatically Create Changelog Entry for PRs #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@copilot Can you update the |
Co-authored-by: saulshanabrook <1186124+saulshanabrook@users.noreply.github.com>
Co-authored-by: saulshanabrook <1186124+saulshanabrook@users.noreply.github.com>
Co-authored-by: saulshanabrook <1186124+saulshanabrook@users.noreply.github.com>
I've updated the Changes made:
The script maintains backward compatibility - Commit: d874184 |
Co-authored-by: saulshanabrook <1186124+saulshanabrook@users.noreply.github.com>
… and tests - Renamed increment_version.py to modify_changelog.py - Consolidated backward compatibility logic into main() - Added subcommands: bump_version and update_changelog - Updated GitHub workflows to use new command format - Added comprehensive tests for both functionalities - Improved argument parsing and error handling Co-authored-by: saulshanabrook <1186124+saulshanabrook@users.noreply.github.com>
CodSpeed WallTime Performance ReportMerging #313 will not alter performanceComparing Summary
Footnotes |
CodSpeed Instrumentation Performance ReportMerging #313 will not alter performanceComparing Summary
Footnotes |
def test_bump_version_minor(): | ||
"""Test version bumping with minor increment.""" | ||
with tempfile.TemporaryDirectory() as temp_dir: | ||
temp_path = Path(temp_dir) | ||
|
||
# Create mock Cargo.toml | ||
cargo_content = '''[package] | ||
name = "test-package" | ||
version = "1.2.3" | ||
edition = "2021" | ||
''' | ||
cargo_path = temp_path / "Cargo.toml" | ||
cargo_path.write_text(cargo_content) | ||
|
||
# Create mock changelog | ||
changelog_content = '''# Changelog | ||
|
||
## UNRELEASED | ||
|
||
## 1.2.3 (2024-01-01) | ||
|
||
- Some old change | ||
''' | ||
docs_dir = temp_path / "docs" | ||
docs_dir.mkdir() | ||
changelog_path = docs_dir / "changelog.md" | ||
changelog_path.write_text(changelog_content) | ||
|
||
# Run the script | ||
result = subprocess.run([sys.executable, | ||
str(Path(__file__).parent.parent.parent / "modify_changelog.py"), | ||
"bump_version", "minor"], | ||
capture_output=True, text=True, cwd=temp_path) | ||
|
||
assert result.returncode == 0 | ||
assert result.stdout.strip() == "1.3.0" | ||
|
||
# Check Cargo.toml was updated | ||
updated_cargo = cargo_path.read_text() | ||
assert 'version = "1.3.0"' in updated_cargo | ||
|
||
|
||
def test_bump_version_major(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you combine these to one test using pytest.param to pass in the start version, end version, and bump type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combined the three version bump tests into one parameterized test using pytest.param as requested. The test now takes start_version, bump_type, and expected_version parameters, making it more concise and maintainable. Commit: 996332b
## UNRELEASED | ||
|
||
- Fix important bug [#123](https://github.com/egraphs-good/egglog-python/pull/123) | ||
|
||
## 1.2.3 (2024-01-01) | ||
|
||
- Some old change | ||
''' | ||
docs_dir = temp_path / "docs" | ||
docs_dir.mkdir() | ||
changelog_path = docs_dir / "changelog.md" | ||
changelog_path.write_text(changelog_content) | ||
|
||
# Run the script | ||
result = subprocess.run([sys.executable, | ||
str(Path(__file__).parent.parent.parent / "modify_changelog.py"), | ||
"update_changelog", "123", "Fix important bug"], | ||
capture_output=True, text=True, cwd=temp_path) | ||
|
||
assert result.returncode == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this test change the title for this issue and verify that it modifies the existing changelog entry added for it instead of making a new one? So that if a user modifies their PR title, the entry will be updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the test to verify that changing a PR title modifies the existing changelog entry instead of creating a duplicate. The script now supports updating existing entries when PR titles change, ensuring users can modify their PR titles and have the changelog automatically updated. Commit: 996332b
… update functionality Co-authored-by: saulshanabrook <1186124+saulshanabrook@users.noreply.github.com>
for more information, see https://pre-commit.ci
The comment appears to be incomplete - it says "Can you update the " but doesn't specify what needs to be updated. Could you please clarify what you'd like me to update? |
This PR refactors the changelog automation system to use a cleaner subcommand structure and adds comprehensive test coverage as requested in the feedback.
Key Changes
Renamed and Restructured Script
increment_version.py
tomodify_changelog.py
for better claritypython modify_changelog.py bump_version <major|minor|patch>
for version bumpspython modify_changelog.py update_changelog <number> <title>
for PR entriesUpdated GitHub Workflows
.github/workflows/update-changelog.yml
to use new subcommand format.github/workflows/version.yml
to use new script name and formatEnhanced Changelog Update Functionality
Comprehensive Test Suite
python/tests/test_modify_changelog.py
with full test coveragepytest.param
for better maintainabilityBenefits
The refactored system maintains all existing functionality while providing a more intuitive command structure, robust test coverage, and intelligent handling of changelog entry updates.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.