Skip to content

Commit

Permalink
Improve bump external releases tool to properly support palantir
Browse files Browse the repository at this point in the history
palantir-cli releases respect to all the other tools have a name that is more human like and less automation friendly.
Still, releases (also for prior tools) are based on tags that are automation friendly.

In here, we switch over from using the name of the release to use the name of the tag associated to the release
  • Loading branch information
macisamuele committed Jul 13, 2024
1 parent fb61cd8 commit 30e5e2a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/bump_external_releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@


def bump_release(github_project, tool_name):
print(f"Checking for {tool_name} updates")
try:
with urlopen(f"https://api.github.com/repos/{github_project}/releases/latest") as request: # nosec: disable=B310
latest_version = json.load(request)["name"].lstrip("v")
latest_version = json.load(request)["tag_name"].lstrip("v")
except: # noqa: E722 (allow usage of bare 'except')
traceback.print_exc()
return False
Expand All @@ -23,14 +24,14 @@ def bump_release(github_project, tool_name):
with tool_name_version_path.open(mode="r") as f:
default_version = f.readline().split()[0]

print(f"Latest version: {latest_version}, repository version: {default_version}")
if default_version == latest_version:
return False

with tool_name_version_path.open(mode="w") as f:
f.write(f"{latest_version}\n")

message = f"Bump {tool_name}: {default_version} => {latest_version}"
print(message)

def call(*args):
print(f"Executing: {args}")
Expand Down Expand Up @@ -71,7 +72,7 @@ def bump_google_java_formatter():
def bump_palantir_java_formatter():
return bump_release(
github_project="jsonschema2dataclass/palantir-cli",
tool_name="palantir-cli",
tool_name="palantir",
)


Expand Down

0 comments on commit 30e5e2a

Please sign in to comment.