Skip to content
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

fix(fw): handle signed tags in releases-json.py #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions scripts/releases-json.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,29 @@ def parse_changelog(


def find_revision(version: str) -> str:
FIRMWARE_TAG_QUERY = (
FIRMWARE_REF_TAG_QUERY = (
"https://api.github.com/repos/trezor/trezor-firmware/git/refs/tags/{tag}"
)
FIRMWARE_SIGNED_TAG_QUERY = (
"https://api.github.com/repos/trezor/trezor-firmware/git/tags/{sha}"
)

if version.startswith("2"):
tag = f"core/v{version}"
else:
tag = f"trezor-suite/v{version}"

r = requests.get(FIRMWARE_TAG_QUERY.format(tag=tag))
r = requests.get(FIRMWARE_REF_TAG_QUERY.format(tag=tag))
r.raise_for_status()
data = r.json()

# signed tags have one more level of indirection
if data["object"]["type"] == "tag":
r = requests.get(FIRMWARE_SIGNED_TAG_QUERY.format(sha=data["object"]["sha"]))
r.raise_for_status()
data = r.json()

assert data["object"]["type"] == "commit"
return data["object"]["sha"]


Expand Down
Loading