Skip to content

Commit 8df25f9

Browse files
authored
feat: axl add supports using tags with no releases (#927)
1 parent f6142e0 commit 8df25f9

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

crates/axl-runtime/src/builtins/aspect/axl_add.axl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,32 @@ def fetch_release_by_tag(ctx: TaskContext, owner: str, repo: str, tag: str) -> d
151151
response = ctx.http().get(url = url, headers = get_github_headers()).block()
152152

153153
if response.status == 404:
154-
fail("Release " + tag + " not found in " + owner + "/" + repo)
154+
# Release not found - try to verify the tag exists and use it directly
155+
return fetch_tag_as_release(ctx, owner, repo, tag)
155156

156157
if response.status != 200:
157158
fail("Failed to fetch release info: HTTP " + str(response.status))
158159

159160
return json.decode(response.body)
160161

162+
def fetch_tag_as_release(ctx: TaskContext, owner: str, repo: str, tag: str) -> dict:
163+
"""Fetch tag info and create a synthetic release object for tags without releases."""
164+
# Check if the tag exists by trying to fetch it
165+
url = "https://api.github.com/repos/" + owner + "/" + repo + "/git/refs/tags/" + tag
166+
response = ctx.http().get(url = url, headers = get_github_headers()).block()
167+
168+
if response.status == 404:
169+
fail("Tag " + tag + " not found in " + owner + "/" + repo)
170+
171+
if response.status != 200:
172+
fail("Failed to fetch tag info: HTTP " + str(response.status))
173+
174+
# Create a synthetic release object with the tag name
175+
return {
176+
"tag_name": tag,
177+
"author": {"login": "unknown"},
178+
}
179+
161180
def compute_integrity(ctx: TaskContext, url: str, temp_file: str) -> str:
162181
"""
163182
Download a file and compute its SHA512 integrity hash in SSRI format.

0 commit comments

Comments
 (0)