Comments (13)
Currently it is not possible to not fail the workflow if no artifact is found
Some customization is on the way for upload-artifact
: actions/upload-artifact#104
Perhaps a similar option could prove useful for download-artifact
. Something like if-no-artifact:
with options error
, warn
or ignore
? 🤔
from download-artifact.
@benjamincharity maybe use
continue-on-error: true
-- see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
from download-artifact.
Stumbled across this need and found no way of checking if some artifact exists. So created a new action: https://github.com/marketplace/actions/check-artifact-existence
You can add a new step that is going to expose and output denoting if an artifact exists or not by the given artifact name:
uses: actions/xSAVIKx/artifact-exists-action@v0
id: check_coverage_artifact
with:
name: 'coverage-artifact'
Then you can use steps.check_coverage_artifact.outputs.exists
(true/false) in the conditions.
from download-artifact.
@benjamincharity you should check on this again.
i dd a quick playground to replicate the behavior you described.
i used continue-on-error: true
it marks the workflow as passed, badges are passed.
even the step is marked as passed. see https://github.com/jkowalleck/playground_download-artifact_issue-42/runs/1022858445?check_suite_focus=true
PS:
nevertheless i like idea of @konradpabjan as of #42 (comment)
from download-artifact.
@jkowalleck thanks for calling this out. From your test it sure does looks like you are correct. I'll be happy to be wrong on this 😄 I will give it a test as soon as I can. Thanks!
from download-artifact.
Hi, we fixed it in if statement. We check for existence of coverage file:
- name: Check file existence for sonar integration
id: sonar
uses: andstor/file-existence-action@v1
with:
files: "sonar-project.properties, coverage/lcov.info"
- name: Upload coverage file
if: steps.sonar.outputs.files_exists == 'true'
uses: actions/upload-artifact@v2
with:
name: coverage-file
path: coverage/lcov.info
hope it helps someone, we made it defensive since its a pipeline for multiple apps. Some are mature and some not :)
from download-artifact.
Just don't use this action and call gh
directly:
- name: Download artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo $(gh run download -n my-artifact-name)
https://cli.github.com/manual/gh_run_download
from download-artifact.
Any updates on this issue?
from download-artifact.
Currently it is not possible to not fail the workflow if no artifact is found
Some customization is on the way for
upload-artifact
: actions/upload-artifact#104Perhaps a similar option could prove useful for
download-artifact
. Something likeif-no-artifact:
with optionserror
,warn
orignore
? 🤔
I was having the same issue. After reviewing the method used, I can see that if you don't specific a name on the download, it will attempt to create the directories regardless.
const artifactClient = artifact.create() if (!name) { // download all artifacts core.info('No artifact name specified, downloading all artifacts') core.info( 'Creating an extra directory for each artifact that is being downloaded' )
This worked for me as a work around.
from download-artifact.
@benjamincharity maybe use
continue-on-error: true
-- see docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
I called this out in the original edit. There are multiple ways to functionally unblock ourselves to get around this, but from what I've seen each method will still mark our workflow as failed in the PR and primary repo badge. So any contributor or consumer needs to actually go see if our build is really failing or if it is just one optional step that is failing.
from download-artifact.
@konradpabjan would you accept a PR that adds the if-no-artifact
input as you suggested?
from download-artifact.
Hi, we fixed it in if statement. We check for existence of coverage file:
- name: Check file existence for sonar integration id: sonar uses: andstor/file-existence-action@v1 with: files: "sonar-project.properties, coverage/lcov.info" - name: Upload coverage file if: steps.sonar.outputs.files_exists == 'true' uses: actions/upload-artifact@v2 with: name: coverage-file path: coverage/lcov.info
hope it helps someone, we made it defensive since its a pipeline for multiple apps. Some are mature and some not :)
Actually not sure it solves anything because we're talking about download here. How would you check that the file in the artifact exists if it isn't downloaded yet ?
Did someone find a workaround ?
@benjamincharity maybe use
continue-on-error: true
-- see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error
This would be the best solution imho.
I'll probably make an action myself returning true or false as an output if there are artifacts. I can't think of another way to do it for now
from download-artifact.
In my case, I was able to do the following.
- id: check-artifact-exist
run: |
url="https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${run-id}/artifacts"
echo "artifact-name=$(curl -fsSL "$url" | jq -r '.artifacts[0].name')" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
if:
${{ steps.check-artifact-exist.outputs.artifact-name ==
'xxx' }}
from download-artifact.
Related Issues (20)
- [bug] Matching names and merge-multiple causes data corruption HOT 6
- [bug] Unable to download artifact(s): Unable to download and extract artifact: Request timeout HOT 1
- [bug] Artifact download failure on latest `master` HOT 5
- [feat req] Update node version to 20 HOT 2
- [bug]-Getting Warning about the deprecation-v4.1.2 HOT 3
- [feat req] Allow timeout input setting
- [bug] Losing compatibility from aws-cli docker image on v4 HOT 4
- [bug] Z_BUF_ERROR Error: unexpected end of file
- [feat req] Option to fail if no files were downloaded
- [bug] The merge-multiple input doesn't work correctly HOT 3
- [bug] Failed to ListArtifacts due to Unexpected token HOT 1
- I
- API (@API)
- merge-multiple backport for v3
- [bug] Artifact not found when I specify the run id HOT 1
- [bug] frequent download corruption on MacOS
- [bug](node:1591) [DEP0005] DeprecationWarning: HOT 3
- [bug] download-artifact errors out downloading artifacts uploaded by upload-artifact HOT 16
- [feat req] add a clean directory option
- [feat req] support output(s) of actions/upload-artifact as input
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from download-artifact.