ncipollo / release-action

An action which manages a github release

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Artifacts cannot be uploaded with commas in their filename?

gerph opened this issue · comments

Describe the bug

The documentation for the artifacts field states that the artifacts are a comma-separated list of files that should be uploaded as artifacts of the release. This means that filenames which contain a comma cannot be uploaded. Filenames with commas are expected for RISC OS releases, as they use the form <filename>,<filetype>. So for example, an HTML file (which has the filetype number 0xFAF) would be named index,faf. Such a file would be unable to be released.

To Reproduce

Reading the documentation. I've used some repositories that required the use of multiple artifacts and I was forced to use the comma form, which raised this as a problem I will encounter.

Expected behavior

Unclear how this can be addressed. Ideally, you would allow the artifacts value to be a list of filenames to upload, which would avoid the delimiting issue. However, I'm not sure whether that's actually allowed for actions - it's possible that action values must be simple.

Alternatively, space-separated filenames could be used instead of comma-separated. But that would obviously preclude filenames with spaces in. Or maybe a | separated list of filenames, as | is rarely used in filenames.

Given that the former option is probably not technically possible, and the latter option is fiddly and breaks compatibility, a possible solution might be to allow the separator to be specified explicitly. Having a artifactsSeparator key which defaults to , would retain the current format, but allow anyone who needs more control to allow commas in their artifact names by changing the separator to a character or sequence which isn't used.

Screenshots
N/A

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
None.

I investigated something similar to this a while back and chose to use a JSON array of strings encoded as a string.
Because all github runners include jq it makes it pretty easy to parse, and also allows virtually any characters.

Only disadvantage is escaping a JSON array as a string properly can be tricky.

Other actions use multiline text to input multiple files..

It could become like this:

with:
  artifacts: |
    file1.zip
    file_with_,_comma.zip

I am not sure if this should be it's own issue, but it seems like the "artifacts:" option does not allow variables.
$FILE_NAME gives out a warning saying file $FILE_NAME couldn't be found.
Maybe @Hipska's comment would also fix this.

$FILE_NAME gives out a warning saying file $FILE_NAME couldn't be found.

Can you not access the Github environment variables using syntax like ${{ env.FILE_NAME }}? Syntax like $FILE_NAME would usually only be used for accessing environment variables within the run section, as it runs within a shell; I wouldn't expect that to work in any other sections.