Skip to content

Commit 2be909c

Browse files
committed
Fix upload file to github with tag
Since we sign our tags, it become an object but not an object we can create a branch from. so we detect it and query the tag for its first object to create a branch from Signed-off-by: Chmouel Boudjnah <[email protected]>
1 parent c3f17d9 commit 2be909c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hack/upload-file-to-github.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ def create_ref_from_tags(args):
5454
args.token, "GET",
5555
f"/repos/{args.owner_repository}/git/{args.from_tag}")
5656
last_commit_sha = jeez["object"]["sha"]
57+
if jeez["object"]["type"] == "tag":
58+
_, jeez = github_request(args.token, "GET", jeez["object"]["url"])
59+
last_commit_sha = jeez['object']["sha"]
60+
5761
print("TAG SHA: " + last_commit_sha)
5862

5963
branchname = f"release-{os.path.basename(args.from_tag)}"
@@ -67,8 +71,8 @@ def create_ref_from_tags(args):
6771
"ref": branch_ref,
6872
"sha": last_commit_sha
6973
})
70-
except Exception:
71-
pass
74+
except Exception as e:
75+
raise e
7276
args.branch_ref = branch_ref
7377
return upload_to_github(args)
7478

0 commit comments

Comments
 (0)