Skip to content

Downloading a GitHub release assumes the first asset is correct #134

@RickyDaMa

Description

@RickyDaMa

def download_latest_github_release(
user: str,
repo: str,
dst: str = None,
github_token: str = None,
ignore_static: bool = True,
):
headers = {}
if github_token:
headers["Authorization"] = f"Token {github_token}"
latest_release = requests.get(
f"https://api.github.com/repos/{user}/{repo}/releases/latest",
headers=headers,
).json()
headers["Accept"] = "application/octet-stream"
dl_url = latest_release["assets"][0]["url"]
zip_file = download_file(dl_url, headers=headers)

(line 72, the [0])

In a project I'm working on, this downloads the wrong release artifact, resulting in an error later on. When using the GitHub Action, there's currently no way to work around this

A couple of suggestions:

  1. Some kind of filtering support (both in diffenator2 and its GitHub action) or other means of selection
  2. For the GitHub action, log the name of the file being downloaded so this is easier to debug :)

I don't need an urgent fix, just thought it was worth having on the issue tracker!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions