Closed lelegard closed 5 months ago
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
Artifacts
get the link for xchammer by right clicking xchammer
( https://github.com/pinterest/xchammer/suites/1276155763/artifacts/19716224 )curl -L https://github.com/pinterest/xchammer/suites/1276155763/artifacts/19716224
When I ran that command a few mins ago I get Not 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.
+1 : this feature would be useful to me.
Do you have any information for us? š¤ We have a paid subscription and spend a lot of money on a github action. I have a lot of experience in setting up ci/cd of different services and we are easily ready to switch to another one (for example, gitlab ci / bitrise / xcode cloud for ios). The only problem is getting the url for the artifact that our testers use. š¢ The fact that you simply ignore the developers and users of your service for 2 years does not say anything good about you. š¤ At least you could notify us about the approximate dates or write that this feature will never be made. Then we wouldn't bother you.
+1: need the artifact id (or download url) as an output
too
Off-topic
@TWiStErRob, is there any kind of "premium support" channel for corporate users who pay, where this kind of request could get some response?
@lelegard There's this: https://github.com/premium-support, but it doesn't guarantee any prioritization, just a +1. With bugs, it might be different, but this isn't broken, it's just missing š → backlog.
+1! Keeping this alive.
Any update on this?
Any update on this?
Nope. Almost 3 years since I opened it. Still watching it. No news. Most probably, will never be implemented.
@konradpabjan any comments on this? This feature would be really useful.
The Actions API doesn't seem to properly adress the problem (in an easy manner).
Here's a similar issue, that was (in my opinion) mistakenly closed.
+1: need it too
I would love to be able to link the artifacts to the pull request for people to download.
This is exactly what I've been trying to do and finally came across this issue. Seems like a reasonable request. If I run a test, and the test fails, I'd like to store the test results as an artifact and post a link to those results as a comment on the PR so people can see why a test failed.
As mentioned in https://github.com/actions/upload-artifact/issues/50#issuecomment-639170787, the GitHub Actions Artifacts API does not show artifacts uploaded during a workflow until after that run has finished. And yet, this is precisely what actions/download-artifact
is doing in this official example from Passing data between jobs in a workflow:
job_1:
steps:
- uses: actions/upload-artifact@v3
with:
name: homework
path: math-homework.txt
job_2:
steps:
- uses: actions/download-artifact@v3
with:
name: homework
Interestingly, actions/download-artifact@v3
accomplishes this via @actions/artifact
method downloadArtifact
, which lists all artifacts for the current run and filters for the requested artifact by name:
const artifacts = await downloadHttpClient.listArtifacts() if (artifacts.count === 0) { throw new Error( `Unable to find any artifacts for the associated workflow` ) } const artifactToDownload = artifacts.value.find(artifact => { return artifact.name === name })
Source: actions/toolkit@6c1f9:packages/artifact/src/internal/artifact-client.ts#L164-L173
I presume @actions/artifact
can access uploaded artifacts before the run has finished because it uses a private GitHub Actions API:
export function getArtifactUrl(): string { const artifactUrl = `${getRuntimeUrl()}_apis/pipelines/workflows/${getWorkFlowRunId()}/artifacts?api-version=${getApiVersion()}` debug(`Artifact Url: ${artifactUrl}`) return artifactUrl }
Source: actions/toolkit@6c1f9:packages/artifact/src/internal/utils.ts#L221-L225
Unfortunately, @actions/artifact
does not provide a way to obtain the artifact URL without downloading the artifact.
Based on this, GitHub already has the means to access uploaded artifacts before the run is finished. What is missing is a way to get the artifact URL without also downloading it.
+1: Wow 1,084 day since this was requested and not a peep. I just can't fathom how GitHub thinks this is ok. If I went this long without responding to a customer request (even just to say sorry no can do) I don't think my business would last long.
At times it feels like Actions is just an after thought to them.
Since no one picked up this issue yet, I've created a new one -- hopefully someone will see it -> https://github.com/actions/upload-artifact/issues/382
+1, need the download url as an output to send it in email :(
+1
makes me wonder how many up votes we need to gather before @konradpabjan (or someone else) will notice and finally implement this feature. š¤
makes me wonder how many up votes we need to gather before @konradpabjan (or someone else) will notice and finally implement this feature. š¤
It could be impossible in the current GitHub design. Artefact Id could be unknown while the workflow runs. But I hope I'm wrong.
Hey everyone. I'm curious to know if there is an easy way to obtain the artifact URL from a former job (Not step) for a job depending on the former? Given the fact that I can download artifacts uploaded in a previous job using the download-artifact action tells me that there is a way to obtain the URL. My question is, if that way is easy to achieve within GitHub Actions...
I know this isn't really the place to ask, but my attempts at asking on the GitHub Community ended on deaf ears unfortunately.
@Andre601
You can use the gh cli to get the url.
gh api "/repos/{owner}/{repo}/actions/artifacts"
In the return json is the key archive_download_url
. You can use that to download. If you're using Actions you can also use dawidd6/action-download-artifact
. If you use unique names for your artifacts it will find that specific artifact and download it.
Note: The dawidd6/action-download-artifact cannot download artifacts from the same run, but can from other runs.
- name: Download PR Workspace
uses: dawidd6/action-download-artifact@v2.26.0
with:
if_no_artifact_found: fail
github_token: ${{secrets.GITHUB_TOKEN}}
name: ${{ env.ARTIFACT_NAME }}
You can checkout the action here.
@Andre601
You can use the gh cli to get the url.
gh api "/repos/{owner}/{repo}/actions/artifacts"
In the return json is the key
archive_download_url
. You can use that to download. If you're using Actions you can also usedawidd6/action-download-artifact
. If you use unique names for your artifacts it will find that specific artifact and download it.Note: The dawidd6/action-download-artifact cannot download artifacts from the same run, but can from other runs.
- name: Download PR Workspace uses: dawidd6/action-download-artifact@v2.26.0 with: if_no_artifact_found: fail github_token: ${{secrets.GITHUB_TOKEN}} name: ${{ env.ARTIFACT_NAME }}
You can checkout the action here.
It's not really about the download, but just getting the URL to it...
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:
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:
The last command would display something like: