Search code examples
githubwget

download gitub artifact from url using wget


I am trying to follow these docs to download an artifact from github using githubs API:

https://docs.github.com/en/rest/actions/artifacts#download-an-artifact

I ran the curl command given in the docs, and it gave me the following url from which to download the artifact (I have replaced the specifics with ...)

https://pipelines.actions.githubusercontent.com/serviceHosts/..../_apis/pipelines/1/runs/16/signedartifactscontent?artifactName=my-artifact&urlExpires=....&urlSigningMethod=HMACV2&urlSignature=....

I am able to download the artifact by putting the URL into my browser (it automatically downloads when the URL is visited) however I tried to use wget to download it via console and got this error:

wget https://pipelines.actions.githubusercontent.com/... # the command I ran

HTTP request sent, awaiting response... 400 Bad Request # the error I got

How can I download a zip file to console? Should I use something other than wget?

I'd like to clarify that viewing this link in the browser is possible even when not logged in to github (or when in private browsing). Also, I can download the zip file at the link as many times as I would like before the link expires after 1 minute. Also my repo is private, which is necessary for my work. I need to use an access token when doing the curl command as described in the docs, however the link that is returned to me does not require any authentication when accessed via a browser.


Solution

  • The problem was that I didn't put quotes around my url. I needed to do this:

    wget "https://pipelines.actions.githubusercontent.com/serviceHosts/..../_apis/pipelines/1/runs/16/signedartifactscontent?artifactName=my-artifact&urlExpires=....&urlSigningMethod=HMACV2&urlSignature=...."