-
Notifications
You must be signed in to change notification settings - Fork 736
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
Download an artifact from the command line? #89
Comments
We have some APIs for artifacts, you can check them out here: https://developer.github.com/v3/actions/artifacts/ A combination of the list and the download artifact APIs should give you all of the information you need and this will work from any command line. With the download API you can get a redirect URL that will allow you do download an artifact. You just need to make sure to pass in an appropriate token token: https://developer.github.com/v3/#authentication The APIs are a little bit limited though (the redirect URL is only valid for a minute), and you can't use these APIs when a workflow hasn't finished as the artifacts won't show up yet. |
@konradpabjan I'm afraid you misunderstood the issue. I know how to download an artifact given an API url and how to authenticate that request. A stated in the original description, I created a bot account with correct permissions for that purpose. The question is, when I go to the Github Actions UI and see one specific artifact that I would like to download, how do I get to a download link for that artifact? The download link that is displayed in the browser is for
and I don't know the mapping between this url and the API url that I would need. |
Apologies for the misunderstanding The first part of the URL, The second part of the URL, What you probably need to do to get the artifact ID is to search using the workflow run id: https://developer.github.com/v3/actions/artifacts/#list-workflow-run-artifacts And to get the workflow run id, you need to use some of our other APIs: https://developer.github.com/v3/actions/workflow-runs/ It might be a little painful, but if you really want to construct the URL yourself you can try this out 😀 |
@89z Great, thanks! |
What in hell does it mean? There is no |
Maybe the message meant the |
If you are using GitHub Action, you can download artifact via token that is always present
|
just tried, and only got 1kb of downloaded file curl -H "Accept: application/vnd.github+json" -H "Authorization: token github_pat_xxxxxxxx" -L -o tmp.zip "https://github.com/dimaslanjaka/android-traffic-exchange/actions/runs/8029763220/artifacts/1271862961" |
Same.. What is the trick? |
@dimaslanjaka You need the |
If you use GHSE make sure that you selected correct Host server.
|
This seems fairly simple, but I'm stumped: I want to download an artifact from the command line.
I have a public repository generating artifacts from a workflow run. By going to the Github Actions UI and navigating to the workflow, I get URL like this and can download the artifacts using my browser:
On the command line, trying to
curl
the same URL leads to a 404 error.From #51 we know that this needs a github user account, so I registered a new bot account and gave it "read" access to the repository, and generated a personalized access token with
repo
scope.However, using this token I still get a 404 error when trying to download above url. I believe that is due to the fact that the access token is valid for
api.github.com
, but not for the "regular" github site.So, my problem is: How do I go from the artifact URL shown in the Github UI to the corresponding api URL that can be used to download the artifact from the command line? Or alternatively, what kind of token do I need to be able to download from the location shown above?
The text was updated successfully, but these errors were encountered: