Skip to content

Add new option to specify behavior if no files found - #104

Merged
konradpabjan merged 8 commits into
mainfrom
konradpabjan/no-files-found
Jul 31, 2020
Merged

Add new option to specify behavior if no files found#104
konradpabjan merged 8 commits into
mainfrom
konradpabjan/no-files-found

Conversation

@konradpabjan

@konradpabjan konradpabjan commented Jul 27, 2020

Copy link
Copy Markdown
Contributor

Overview

Addresses #91 and #90

By default, if no files are found with the provided path input, the v2 version of upload-artifact with not fail and there will be a warning in the logs.

There have been numerous requests for the action to fail or for no warning so I'm adding an extra input option that will allow users to control this. The new input is called if-no-files-found (not too sure about this name though, any ideas will be appreciated). The available options include warn (default), error and ignore. The default remains as warn since we don't want existing behavior to change.

README update: 🎨 rendered 🖌

Testing

Upload with default behavior

https://github.com/konradpabjan/artifact-test/runs/918666195?check_suite_focus=true#step:4:23

image

Upload with warn

https://github.com/konradpabjan/artifact-test/runs/918670916?check_suite_focus=true#step:4:23

image

Upload with error

https://github.com/konradpabjan/artifact-test/runs/918715964#step:4:23

image

Upload with ignore

https://github.com/konradpabjan/artifact-test/runs/924130458?check_suite_focus=true#step:4:23

image

Upload with an option that is not available

https://github.com/konradpabjan/artifact-test/runs/918907180#step:4:15

image

Comment thread action.yml
path:
description: 'A file, directory or wildcard pattern that describes what to upload'
required: true
if-no-files-found:

@konradpabjan konradpabjan Jul 27, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My biggest question/concern is what should this input be? 🤔I really can't think of a good name so any ideas would be great. if-no-files-found sounds a little "mech" but I can't think of anything better

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I though about this a little bit more, if-empty or if-empty-artifact are some other options

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those all sound reasonable, or "if-missing"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "ignore" would be clearer and more natural than "suppress" (from user's point of view they're ignoring a situation/condition, not suppressing an exception)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like ignore a lot more compared to suppress. Thanks for the suggestion 😃

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sticking with if-no-files-found after some internal discussions. A wee bit verbose, but it's clear as to the intention

Comment thread src/input-helper.ts
/**
* Helper to get all the inputs for the action
*/
export function getInputs(): UploadInputs {

@konradpabjan konradpabjan Jul 27, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actions/checkout action has ALOT of available options and it has a input-helper file that is used get everything. I'm copying the same thing. In the future if there are more input options needed for things like retention, this will help out. I would also like to add an option to make searching via symlinks user-customizable, so another option would be needed for that as well.

@konradpabjan
konradpabjan marked this pull request as ready for review July 27, 2020 16:57
@konradpabjan konradpabjan added the help wanted Extra attention is needed label Jul 27, 2020
@konradpabjan
konradpabjan requested a review from yacaovsnc July 31, 2020 15:16
@konradpabjan konradpabjan linked an issue Jul 31, 2020 that may be closed by this pull request
4 tasks
@konradpabjan
konradpabjan merged commit 5ba29a7 into main Jul 31, 2020
@konradpabjan
konradpabjan deleted the konradpabjan/no-files-found branch July 31, 2020 15:27
aguibert pushed a commit to aguibert/upload-artifact that referenced this pull request Oct 20, 2020
* Add new option to specify behavior if no files found

@Strongbone315 Strongbone315 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants