upload-artifact
upload-artifact copied to clipboard
Support artifact URL output
Hi,
This suggestion has been discussed here in the GitHub community forum.
In a Github Actions job, after an upload-artifact
step, I would like to get the URL of the published artifact in a subsequent step.
The idea is a job using the following steps:
- Build a binary.
- Upload the binary as artifact.
- Trigger a REST API in some Web server, passing the URL of the artifact in a POST parameter, so that the remote server can download the artifact.
How would you get the URL of the artifact in a subsequent step?
I know that there is an Actions API currently in development. But, here, the question is about passing information from the upload-artifact
step to the next step.
It could be something like this:
- name: Upload build
uses: actions/upload-artifact@master
with:
name: installer
path: installer.exe
env-url: FOOBAR
- name: Use URL for something
run: echo "${{ env.FOOBAR }}"
The last command would display something like:
https://github.com/user/repo/suites/123456/artifacts/789123
Ideally you could set it so the links do not expire, and they would serve the correct Content-Type so you could link to images/gifs/videos.
It seems you can get an artifact url via https://developer.github.com/v3/actions/artifacts but the links expire within 1 minute.
@jperl Do you know why it's to be expired after 1 minute?
I do not know why, that is just what their documentation says.
@jperl Hmm, I see. I made an independent issue, https://github.com/actions/upload-artifact/issues/60. This is just letting you know, for the case you want to subscribe or participate in it :)
It seems you can get an artifact url via https://developer.github.com/v3/actions/artifacts but the links expire within 1 minute.
Unfortunately you can't retrieve the artifact during current workflow run, it will become available in the API only after the current run finishes...
This would be a really nice feature to have! I'm working on a Docker image GitHub Action and I want to upload some assets before running my action so they can be used inside the Docker container. If the upload-artifact
action provides a URL to the asset as an output, the I can pass this output as an argument to my action and download the asset using curl
from inside Docker container.
I'm going to bump this again. Many people have asked for this feature - both here, discussions, even Stack Overflow
For example, I'd really like to have the artifact URLs posted as a comment for pull requests. At the moment, this seems impossible because the URL is not available to the current workflow.
It seems you can get an artifact url via https://developer.github.com/v3/actions/artifacts but the links expire within 1 minute.
Unfortunately you can't retrieve the artifact during current workflow run, it will become available in the API only after the current run finishes...
I wonder if you could use https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_run then to process that
I'm going to bump this again. Many people have asked for this feature - both here, discussions, even Stack Overflow
For example, I'd really like to have the artifact URLs posted as a comment for pull requests. At the moment, this seems impossible because the URL is not available to the current workflow.
I was hoping to do this exact thing! I would love to be able to link the artifacts to the pull request for people to download.
+1 for this, or at least the artifact id. @jjangga0214 @jperl the timeout is only for the redirect url. the actual rest endpoint is constant. ref https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#download-an-artifact
I'd find this especially useful to use if I split my pull request and release workflows. I could then reference the artifact built and tested in the PR and publish that directly on release.
Just adding a +1 here - right now, we're considering all sorts of hacky things (uploading artifacts to a seperate FTP server so we can serve links in PRs, woo...).
💯 would love to see this feature. I attempted to run curl
on the artifact for XCHammer in the browser and was surprised to see it wasn't working. The use case of this feature would be to pull the artifact into Bazel, but it'd need some stable URL to do this.
It seems like the only alternative is to create a release to create a stable URL but that might be confusing and spam the watchers if we end up doing a release per commit.
@jerrymarino afaict the url is stable, but you have to follow the redirect to get the artifact.
@jeacott1 It'd be awesome for the workflow in question it'd work! Perhaps we're talking about different URLs then - I'm hoping to consume the artifact urls on the github website found via browser and they seem incompatible with curl and bazel:
I've attempted to do the following steps to pull artifacts with curl and Bazel
- navigate to https://github.com/pinterest/xchammer/actions/runs/283307177 in a web browser
- under
Artifacts
get the link for xchammer by right clickingxchammer
( https://github.com/pinterest/xchammer/suites/1276155763/artifacts/19716224 ) - try to pull with curl following redirects
curl -L https://github.com/pinterest/xchammer/suites/1276155763/artifacts/19716224
When I ran that command a few mins ago I getNot Found
I circulated though a few other issues and found mentions of artifact URL from a github actions API that lasts 1 minute. Is this the URL you're pointing to?
@jerrymarino yeah, you are using the wrong initial url. you need to use the one here which is stable: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#download-an-artifact
tldr: GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}
and then follow the redirect
the real issue is that when you save an artifact you dont get the id in a response as reference later.
@ghutchis @abhijitvalluri I have created this action that creates a comment in pull request and/or associated issues with the link to all / subset of artifacts https://github.com/marketplace/actions/workflow-artifact-pull-request-comment
Any updates? There's a real intention to provide the ID after the upload?
It would be really useful to have access to artifacts before run completion. In my case I need retrieve artifacts download URLs and publish it in custom issue comment. And it must be done in one workflow run, I cannot use 2 separate workflows for generating artifacts and publication comment.
+1 for this feature request.
+1 - this would be a very useful feature!
+1 This feature would save me so many headaches! Would be so awesome!
+1 Looking forward to this useful feature!!!
This feature would be nice, looking forward to it too
I originally posted this topic more than two years ago. It got 134 👍 and 23 responses, mostly "I would like it too". The suggestion does not seem too difficult. And we got zero feedback from the Github team. They probably follow their own track and ignore users' requests. This is a bit frustrating. But, let's be realistic, this is a free service, we have no influence.
Yes, it's a bit frustrating. I've used @tonyhallett action as linked above. It works well for https://github.com/openchemistry/avogadrolibs - It would be great if GitHub added this support, but in the meantime, there is a workaround.
Off topic a bit: but @lelegard free?. Yes, there's a free tier, but there are many paid users.
On topic: this is the second most voted issue in this repo, with an easy fix, I think it deserves an @actions to please check this TL;DR and respond.
@lelegard a tip: in OP you were asking for env.
, but actions have outputs. Here is live example.
Off topic a bit: but @lelegard free?. Yes, there's a free tier, but there are many paid users.
@TWiStErRob, is there any kind of "premium support" channel for corporate users who pay, where this kind of request could get some response?
Open source developers and free users acknowledge their lack of influence.
+1 : this feature would be useful to me.
+1 lol its fantastik and only feature lack that stops my super duper company to buy github organization license
+1 : this would be useful to me.