API to download artifact

Is there an API for Github Actions?

I need to download an artifact produced by actions/upload-artifact.

I don’t mean to download the artifact for a subsequent job, like I can do with actions/download-artifact.

Thanks,

Danilo

15 Likes

Bump as I’m looking for this as well.

1 Like

Hi @tuler,

Thank you for being here and our apologies for the delay in response. At this time there is not, however this is very much on the roadmap and being worked on. 

Hi @andreagriffiths11,

Thanks for your response. Can you provide ETA for this API?

+1

very upsetting that so cool feature released without API…

1 Like

We’re working on this now. Rough ETA is 4-6 weeks.

5 Likes

Is the API available now?

Yes, this is now available.

https://developer.github.com/v3/actions/artifacts/

4 Likes

Is there a way to get the latest Run id? 

curl -sL https://api.github.com/repos/USER/REPO/actions/workflows/WORKFLOW.yml/runs | jq -r '.workflow_runs[0].id?'

With, of course, USER, REPO and WORKFLOW adjusted

The documentation is wrong. It says everyone with read access can download artifacts, but when I try the examples, it wants admin rights.

https://developer.github.com/v3/actions/artifacts/#download-an-artifact

EDIT: Also, when I give curl an admin user, it downloads the file right away and does not respond with the “Location:” as described.

EDIT2: Ah ok, it is intended to download the file right away but gives the Location for potential subsequent accesses. This was not immediately clear. Still, the rights issue still persists and it would be a bit of hassle to always have an admin user (token) handy in all our CI workflows that want to use this API.

This is great, but no one has updated the main github documentation.  On the page persisting-workflow-data-using-artifacts it says:
GitHub does not currently offer a REST API to retrieve uploaded artifacts.
If you need to access artifacts from a previous workflow run, you’ll need to store the artifacts somewhere. For example, you could run a script at the end of your workflow to store build artifacts on Amazon S3 or Artifactory, and then use the storage service’s API to retrieve those artifacts in a future workflow.

It seems like this has been superceeded; can someone from GitHub please update the documentation?

@jpfeuffer I have the same question, documentation says only read access is required but when I run the command, it says “Must have admin rights to Repository.”

Do you think it could be because I’m working on a forked repository and not the original one?

Bump as I really need this too.