-
Notifications
You must be signed in to change notification settings - Fork 1
Refactoring/498 centralize changelog code and preparation steps #499
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
Merged
ArBridgeman
merged 21 commits into
main
from
refactoring/498_centralize_changelog_code_and_preparation_steps
Jul 22, 2025
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ea6693c
Add git utility class & test
ArBridgeman 8501403
Switch from decorator to annotated type so can be shared later
ArBridgeman ae1a58d
Remove conflicting git files as they are no longer used in code
ArBridgeman 6706fa9
Extract combined functionality into get_dependencies & modify for get…
ArBridgeman 75093f4
Improve name of function & switch to verb tense without s
ArBridgeman f7b866a
Move create_and_switch_to_branch to util.git
ArBridgeman 9666080
Remove unused function _is_valid_version
ArBridgeman f608f7f
Add depth to see if resolves issues
ArBridgeman c83e75b
Refactor Changelog modifications so clearer order of operations and h…
ArBridgeman d12c2a5
Add changelog entry
ArBridgeman ab80fc1
Fix variable name & value as drifted from existing implementation
ArBridgeman 73302d7
Fix comment
ArBridgeman 247042d
Switch to AfterValidator so pre-validation works as expected
ArBridgeman 734636a
Switch from string that we split into a list to a most sustainable li…
ArBridgeman 7c23d20
Rename UNRELEASED_TEXT to UNRELEASED_INITIAL_CONTENT
ArBridgeman 8f2b60b
Update docstring per review to clarify new file
ArBridgeman 1845d48
Remove unused tmp_path from fixtures
ArBridgeman 03b35f2
Set scope more explicitly and write comment once on test class
ArBridgeman 8349817
Rename test variables and put into class so relationship is clearer
ArBridgeman 6c66934
Update comment to be more explicit
ArBridgeman 48e9a07
Update PTB dependencies
ArBridgeman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# Unreleased | ||
|
||
## Refactoring | ||
|
||
* #498: Centralized changelog code relevant for `release:trigger` & robustly tested |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import subprocess # nosec | ||
from functools import wraps | ||
from pathlib import Path | ||
|
||
|
||
def run_command(func): | ||
@wraps(func) | ||
def wrapper(*args, **kwargs) -> str: | ||
ckunki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
command_list = func(*args, **kwargs) | ||
output = subprocess.run( | ||
command_list, capture_output=True, text=True, check=True | ||
) # nosec | ||
return output.stdout.strip() | ||
|
||
return wrapper | ||
|
||
|
||
class Git: | ||
ckunki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@staticmethod | ||
@run_command | ||
def get_latest_tag(): | ||
""" | ||
Get the latest tag from the git repository. | ||
""" | ||
return ["git", "describe", "--tags", "--abbrev=0"] | ||
|
||
@staticmethod | ||
@run_command | ||
def read_file_from_tag(tag: str, remote_file: str): | ||
""" | ||
Read the contents of the specified file `remote_file` at the point in time | ||
specified by git tag `tag`. | ||
""" | ||
return ["git", "cat-file", "blob", f"{tag}:{remote_file}"] | ||
|
||
@staticmethod | ||
def copy_remote_file_locally( | ||
ckunki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tag: str, remote_file: str, destination_directory: Path | ||
) -> None: | ||
""" | ||
Copy the contents of the specified file `remote_file` at the point in time | ||
specified by git tag `tag` and copy it into the local `destination_directory/remote_file`. | ||
""" | ||
contents = Git.read_file_from_tag(tag=tag, remote_file=remote_file) | ||
(destination_directory / remote_file).write_text(contents) | ||
|
||
@staticmethod | ||
@run_command | ||
def create_and_switch_to_branch(branch_name: str): | ||
return ["git", "switch", "-c", branch_name] |
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.