Skip to content

Name Parameter Change for Single-File Artifact Upload #2441

Description

@SuperDude88

Describe the enhancement
The current behavior is to ignore the provided name when a single file is being uploaded. This is pretty unintuitive, and it would be convenient if it could handle the renaming instead of needing to do it manually.

Looking through #2256 this was discussed, and these were the points brought up:

If the caller points at a file directly, doesn't that also indicate naming intent?

This is true, but the file is only being given as the path parameter. If a user explicitly passes a name, it is clear that is the expected name, and the file at path should be uploaded as name. A parameter that does nothing is more confusing, and a user wouldn't provide a different name if they didn't want that to be the filename. This would be more consistent with archived uploads, which use name.

The caller is not required to provide a name, in which case it's artifact

I think this is when it should use the file's name from the path: if a name isn't explicitly given, it should stick with the name of the file it's uploading. The artifact default makes sense when it's multiple files being archived (there isn't always a clear, single default to use), but when uploading a single file the filename from path is a very predictable default.

What do we do with file extension? Do we override just that?

Not sure that I entirely understand what scenario this describes, but I think the behavior described under the first two points is clear/consistent enough that there wouldn't be added confusion around extensions.

Code Snippet
Haven't implemented this yet since I'm not sure if it's a change that would be considered. I can implement/open a PR if this new behavior is desirable.

Additional information
Same issue has come up in actions/upload-artifact#785

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions