Skip to content

Commit af27e01

Browse files
committed
script alias, compare link
1 parent 59f1665 commit af27e01

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

adabot/circuitpython_library_release.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,26 @@ def get_release_info():
150150
}
151151

152152

153-
if __name__ == "__main__":
153+
def get_compare_url(tag_name):
154+
"""
155+
Get the URL to the GitHub compare page for the latest release compared
156+
to current main.
157+
"""
158+
remote_url = subprocess.getoutput("git ls-remote --get-url origin")
159+
if not remote_url.startswith("https"):
160+
remote_url = subprocess.getoutput("git ls-remote --get-url adafruit")
161+
162+
if not remote_url.startswith("https"):
163+
return "Sorry, Unknown Remotes"
164+
165+
compare_url = remote_url.replace(".git", f"/compare/{tag_name}...main")
166+
return compare_url
167+
168+
169+
def main_cli():
170+
"""
171+
Main CLI entry point
172+
"""
154173
logging.basicConfig(
155174
level=logging.INFO,
156175
format="%(asctime)s [%(levelname)s] %(message)s",
@@ -167,6 +186,7 @@ def menu_prompt(release_info):
167186
Returns the choice inputted by the user.
168187
"""
169188
print("This library needs a new release. Please select a choice:")
189+
print(f"Changes: {get_compare_url(release_info['current_tag'])}")
170190
print(
171191
f"1. *default* Bump Patch, new tag would be: {release_info['new_tag_patch']}"
172192
)
@@ -210,3 +230,7 @@ def menu_prompt(release_info):
210230

211231
else:
212232
logging.info("No new commits since last release, skipping")
233+
234+
235+
if __name__ == "__main__":
236+
main_cli()

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ classifiers = [
3535
]
3636
dynamic = ["dependencies", "optional-dependencies"]
3737

38+
[project.scripts]
39+
adabot-release = "adabot.circuitpython_library_release:main_cli"
40+
3841
[tool.setuptools]
3942
packages = ["adabot"]
4043

0 commit comments

Comments
 (0)