actions / actions/toolkit

Name Parameter Change for Single-File Artifact Upload

Open
#2,441 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

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 https://github.com/actions/upload-artifact/issues/785

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Locate the TypeScript entry point and tests for single-file artifact uploads, then inspect how an explicit name and the path basename are handled. Done means an explicit name renames the uploaded file, while an omitted name uses the path's filename, with extension behavior covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.