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

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

Open
RickyDaMa opened this issue Apr 10, 2024 · 1 comment
Open

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

RickyDaMa opened this issue Apr 10, 2024 · 1 comment
Assignees

Comments

@RickyDaMa
Copy link

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!

@m4rc1e m4rc1e self-assigned this Apr 10, 2024
@m4rc1e
Copy link
Collaborator

m4rc1e commented Apr 10, 2024

Thanks Ricky. I'll think of something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants